Hi,

After handcoding the same kind of OM query pull tool again and again for my last few 
projects, I decided to
look at the Torque code to see whether I could generate this straight from the xml 
schema. Texen/Torque turned
out to be easier than I thought so now I have a pretty decent pull tool generator that 
does this:

- Create org.mycompany.myproject.om.tools package

- For each database Foo, generate
    BaseFooQueryTool.java
    FooQueryTool.java (empty extension).

- In BaseFooQueryTool.java, for each table Bar in database Foo generate
    public List getAllBars()    // returns getAllBars(new Criteria())
    protected List getAllBars(Criteria c)    // does BarPeer.doSelect(c)
    protected Bar getBar(ObjectKey pkName)    // does retrieveByPK()
    public Bar getBarFromContextInfo()    // gets pk values from ParameterParser by 
name

The last two methods will be generated with more parameters in case of multiple pks. 
It uses the same Ant task
that is used for generating the OM classes, just with a different set of templates.

I've attached the file generated by my test setup (just two tables).

I've had to manually create and keep up to date exactly this kind of pull tool for my 
last three projects and
that's no fun for projects with 10+ tables.

Obviously the methods I've generated are the ones I needed for my projects... they 
might need to be changed.
But if there is enough interest for this, I wouldn't mind making the changes necessary 
for adding it to Torque
and the TDK.

Anyone interested ?

Age

BaseDefaultQueryTool.java

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to