velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <>
Subject RE: Velocity + Database [long]
Date Thu, 07 Aug 2003 20:17:52 GMT
On Thu, 2003-08-07 at 14:42, Aaron Freeman wrote:
> Again, this is off the cuff so I am sure there are a ton of holes in it, but
> the idea is to get the SQL outside of the Java realm.  A SQL programmer
> could easily modify that template and never look at Java code.  A page
> designer can easily manipulate that database but only via calls through the
> .sql template.

I see what you're saying. Is this any different (other than syntactic
sugar) than using something like a JSP SQL query tag of whichever
nature? (Other than the obvious difference of where the SQL statements
are defined.)

> Right, MVC is a "way", but I am referring to the _implementation_ -- not the
> MVC paradigm.  No the SQL object is a template that is read by a canned Java
> class that executes what it reads out of the template.  The Java class would
> never change.  It is installed with the struts/velocity/whatever server and
> simply reads the proper template, swaps out variable names appropriately and
> executes the SQL.  It knows nothing about the layout of the database or the
> SQL.  It reads, executes, dies.

So, more or less, you want to be able to execute SQL by defining SQL
statements attached to methods in an XML file?

I don't recall the classname now but there's something that will take a
result set and wrap it up providing named accessors to fields
(beanutil's RowSetDynaClass?)... Seems like tweaking some of that with
an XML parser for your config file and a java class generator might be
enough to solve the problem in a relatively easy way.

> Does that help?

Yep, thanks :)


View raw message