Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Apache JDBC utils Date: Wed, 2 May 2012 14:22:59 -0700 (PDT) Organization: http://groups.google.com Lines: 57 Message-ID: <28822840.1257.1335993779644.JavaMail.geo-discussion-forums@pbbpz9> References: NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1335993872 2230 127.0.0.1 (2 May 2012 21:24:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 2 May 2012 21:24:32 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2757 Xref: csiph.com comp.lang.java.programmer:14152 Jan Burse wrote: > *NO* reflection API was used at all, *NO* injection > pattern was used, also no penguins where harmed. The > framework consists of what would one call XDoclet today. > > But instead of XDoclet I use JSP to generate via > its output the Java code for the XXXBeans. The > input are some property files and the JDBC access > to the meta data of the already existing DB. > > +--------+ +-------------+ > | DB | | .properties | > +--------+ +-------------+ > | | > ------ ----- > | | > v v > +--------+ > | JSP | > +--------+ > | > v > +------------+ > | XXXBean | > +------------+ > > Some part of the framework deals with invoking JSP > without browser attention in kind of batch mode. But > using JSP to generate Java code is straight forward. > Check out genbean.jsp, it starts with: > > public class <%=table%>Bean extends util.bean.BeanUtil { > private util.bean.ColumnDescriptor[] columndescriptors; > > And as you might expect it can generate Java code and > place what table has a value in front of Bean. Or something > more elaborate: > > <% > generator.bean.Column col=new generator.bean.Column(); > col.setTable(tab); > col.list(); > while (col.next()) { > %> private <%=col.getType()%> <%=col.getName()%>=<%=col.getNullConst()%>; > <% > } > col.close(); > %> > > The above iterates through the columns of the given table, > and the generates variable declarations. Scriptlet in JSP is an antipattern. -- Lew