You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Matteo Barbieri <m....@ste-energy.com> on 2006/02/02 16:45:58 UTC

Custom BaseObject and BasePeer

Hi,
I have a question:
I need some methods in all objects, obviusly I don't want to write them
on each Base class, and I don't want to modify the BaseObject class.
Is it possible to tell the generator that all Base classes have to
extend MyCustomBaseObject (that extends BaseObject and implements the
methods that I need)?

Thank you
Bye

-- 
RCarter


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


Re: Custom BaseObject and BasePeer

Posted by Guy Galil <Gu...@guardium.com>.
In Torque.jar look for all files with extension .vm 
To change BaseObject and BasePeer you need to look at om/Object.vm and
om/Peer.vm

As to how to edit them see the following reference from Bobbi Fox who
did a lot of work on this here:
"From
http://mail-archives.apache.org/mod_mbox/db-torque-user/200410.mbox/%
3C1098963075.12975.11.camel@localhost%3E
> 
 I end up at http://www.devaki.org/nextobjects/torque-type-map.html
 which tells you how Torque translates data types.
> 
 I found the message you were responding to; at
http://db.apache.org/torque-32/generator/properties-reference.html
 You can see that the build.properties files tells you where the
template
 path is, and the .vm files are in ${template_path}/om
> 
 Once you locate the .vm files, you can see what their doing, and figure
 out how to modify them. On Thu, 2006-02-02 at 17:28 +0100, Matteo"


 Barbieri wrote:
> I can't find those templates, where are they?
> Are they simple to modify?
> Thanks.
> 
> >The Base objects are generated using velocity templates - by default the
> >templates in the Torque jar are used - you can modify the
> >build.properties file to use the templates in some other location by
> >changing useClasspath=false and pointing templatePath to where your
> >templates are.
> >If you want any code to be added in any generated class add it in the
> >template and regenerate your classes.
> >On Thu, 2006-02-02 at 16:45 +0100, Matteo Barbieri wrote:
> >  
> >
> >>Hi,
> >>I have a question:
> >>I need some methods in all objects, obviusly I don't want to write them
> >>on each Base class, and I don't want to modify the BaseObject class.
> >>Is it possible to tell the generator that all Base classes have to
> >>extend MyCustomBaseObject (that extends BaseObject and implements the
> >>methods that I need)?
> >>
> >>Thank you
> >>Bye
> >>    
> >>
> 
> ---------------------------------------------------------------------
> 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


Re: Custom BaseObject and BasePeer

Posted by Matteo Barbieri <m....@ste-energy.com>.
Thomas Fischer wrote:

>>Are they simple to modify?
>>    
>>
>
>Fairly simple.
>  
>

Mmm...
Thank you, I'll try.



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


Re: Custom BaseObject and BasePeer

Posted by Thomas Fischer <fi...@seitenbau.net>.
Matteo Barbieri <m....@ste-energy.com> schrieb am 02.02.2006 17:28:50:

> I can't find those templates, where are they?

Assuming you use Torque 3.2, there is a jar called
torque_gen_templates_3.2.jar (or similar) in the lib subdirectory of the
Torque generator.

> Are they simple to modify?

Fairly simple.


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


Re: Custom BaseObject and BasePeer

Posted by Matteo Barbieri <m....@ste-energy.com>.
I can't find those templates, where are they?
Are they simple to modify?
Thanks.

>The Base objects are generated using velocity templates - by default the
>templates in the Torque jar are used - you can modify the
>build.properties file to use the templates in some other location by
>changing useClasspath=false and pointing templatePath to where your
>templates are.
>If you want any code to be added in any generated class add it in the
>template and regenerate your classes.
>On Thu, 2006-02-02 at 16:45 +0100, Matteo Barbieri wrote:
>  
>
>>Hi,
>>I have a question:
>>I need some methods in all objects, obviusly I don't want to write them
>>on each Base class, and I don't want to modify the BaseObject class.
>>Is it possible to tell the generator that all Base classes have to
>>extend MyCustomBaseObject (that extends BaseObject and implements the
>>methods that I need)?
>>
>>Thank you
>>Bye
>>    
>>

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


Re: Custom BaseObject and BasePeer

Posted by Guy Galil <Gu...@guardium.com>.
The Base objects are generated using velocity templates - by default the
templates in the Torque jar are used - you can modify the
build.properties file to use the templates in some other location by
changing useClasspath=false and pointing templatePath to where your
templates are.
If you want any code to be added in any generated class add it in the
template and regenerate your classes.
On Thu, 2006-02-02 at 16:45 +0100, Matteo Barbieri wrote:
> Hi,
> I have a question:
> I need some methods in all objects, obviusly I don't want to write them
> on each Base class, and I don't want to modify the BaseObject class.
> Is it possible to tell the generator that all Base classes have to
> extend MyCustomBaseObject (that extends BaseObject and implements the
> methods that I need)?
> 
> Thank you
> Bye
> 


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