db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Göschl,Siegfried" <Siegfried.Goes...@drei.com>
Subject RE: Using Torque's project-schema.xml to generate other files
Date Wed, 11 Feb 2004 20:05:54 GMT
Well, I'm not qualified but I give it a try ...

+) Some Java code in Torque does the JDBC magic to generate the schema.xml (done with the
'jdbc' target)

+) The 'om' target for Torque parses the schema.xml and uses Velocity to render those Java
objects (found in the Velocity context) with the given Velocity templates (found in templates\om)
to Java source files. The beauty of Velocity is the usage of reflection to invoke methods
on Java objects on the fly ... :-)

+) The other targets using similar templates, e.g. 'ojb' generates the bare-bone Java files
for ObjectBridge

+) Mentioning xdocs - using the ANAKIA templates you could generate XDOC to be transformed
to HTML. I don't know if there is a setting to automate this?!


Siegfried Goeschl

-----Original Message-----
From: Brent Atkins [mailto:Brent.Atkins@Pro-Sys.biz]
Sent: Wednesday, February 11, 2004 8:46 PM
To: torque-user@db.apache.org
Subject: Using Torque's project-schema.xml to generate other files


Well I managed to switch my project over from an ant build over to maven without too much

(Though someone with commit privileges may want to amend the maven plug-in docs or the
plugin.properties.  I needed to set these properties in project.properties to get it to build
properly - note that you may need additional properties if you are not using

torque.basePrefix = Base
torque.addSaveMethod = true
torque.saveException = Exception

Anyhoo, my question is totally different.  I was just trying to document my problem so others
find it if they needed it...

I'd like to use my project-schema.xml to auto generate some other files.  I'm using Struts
as a
framework and I'd like to avoid having to change a Form, an Action and a View every time I
change my
schema (not to mention the xdocs that I could generate <drool>...</drool>).

It would seem that the schema is already parsed; all I need to do is apply it to another template.
I took a look at the source code and I'm a bit confused.  It seems that the velocity templates
used to generate (what maven would call) Torque-gen.jar which somehow doesn't have the templates

I may be looking at it wrong, so I was wondering if anyone can give me a high level overview
of how
a template becomes a om class during the two compile processes.  I don't need anything too
but a rough road map would help alot.  So far, the best I can figure out is...

1. Template.vm  --Generator-->

2. ???  --project-schema.xml-->

3. Profit! (I mean... foo.class)

If anyone has a high-level explanation of how this happens floating around in your head, I'd
love it
if you could write it out.  Of course if anyone has already used this already and would like
to just
tell me flat out, I wouldn't reject that either :)  Thanks for any help you can provide.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message