commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject [sql] quick heads up...
Date Tue, 10 Sep 2002 18:05:27 GMT
Here's a quick heads up on the commons-sql component. It started with a few
folks trying to refactor the groovy SQL generation stuff from Torque into a
reusable form so that it can be reused on any project that needs to generate
some SQL DDL, such as OJB.

The current site is here...

http://jakarta.apache.org/commons/sandbox/sql/


The basic idea is there's an XML description of the relational database,
such as this...

http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/sql/src/test-input
/datamodel.xml?rev=HEAD

This can then be loaded, via the DatabaseReader (which uses Betwixt) in the
*.sql.io package into a collection of regular beans in the *.sql.model
package...

http://jakarta.apache.org/commons/sandbox/sql/apidocs/index.html


Then the beans can be processed either with normal Java code or with a
templating tool like Velocity.

The *.sql.builder package contains a number of beans that can be used to
generate the SQL DDL to create and drop tables and constraints for different
database implementations etc. The original Velocity scripts for the DDL
creation for each database configuration were a little hard to maintain and
use IMHO, whereas just using regular java code for this bit seemed to work
out OK. Of course folks can easily plugin Velocity scripts to these beans if
they wish or want to preserve their existing scripts etc.

There's an Ant Task, DDLTask in the *.sql.task package, which uses the beans
above to generate the SQL DDL for different physical databases from a given
XML document describing the schema.

Going foward with some minor refactoring we should be able to generate the
documentation of the database, reverse engineer the logical model of a
database from a given JDBC connection etc. Plus ultimately we could enhance
this simple component to auto-create beans and repository descriptors for
OJB etc.

James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message