You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Greg Monroe <Gr...@DukeCE.com> on 2007/03/20 21:07:45 UTC

Adding torque.beanExtends property.

I've been working with a project that uses Struts and Torque recently
and
it struck me that if I could create Torque beans that extended one of
the 
struts ActionForm classes, I'd get a whole set of Struts Form beans for
free.
 
In looking into this, it turned out to be trivial to add a
"torque.beanExtends"
property and modify the beans.vm template to use this if it is set.
 
Anyone see any problems with this?  If not, I'll update the docs to
include 
YACP (yet another config parameter) and check the change in.
Greg Monroe <Mo...@DukeCE.com> (919)680-5050
C&IS Solutions Team Lead
Duke Corporate Education, Inc.
333 Liggett St.
Durham, NC 27701


 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed.  If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you  please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.



RE: Adding torque.beanExtends property.

Posted by Greg Monroe <Gr...@DukeCE.com>.
I checked in the new feature.  It's been tested with Maven 1
and Ant, but I don't have a Maven 2 set up to test the changes
I made to the OMMojo.  They were simple so there shouldn't be
a problem.
 
FWIW, since this is like one of the optional package names, 
there does not need to be a default value in Maven 1, etc. 

________________________________

From: Thomas Fischer [mailto:fischer@seitenbau.net]
Sent: Tue 3/27/2007 10:35 AM
To: Apache Torque Developers List
Subject: RE: Adding torque.beanExtends property.



"Greg Monroe" <Gr...@DukeCE.com> schrieb am 27.03.2007 16:12:38:

> Thomas Fischer wrote:
> > I'd be +1 for this as long as it also finds its way into
> > the maven 1 and maven 2 plugin.
>
> If it's just another build property setting, does anything
> special need to be for Maven 2?
>

I am afraid something special is needed for Maven 2. The parameter needs to
be read by the OMMojo from the plugin's configuration, and must write this
value into the property file which is then read by the TexenTask.
I know this is messy, but this happens because the generator is heavily
tied to ant, so one needs to simulate an ant environment inside the maven 2
plugin :-(.

Also, for the maven 1 plugin, you need to define a standard value if your
new property is not set. This needs to be done in a config file in the
maven 1 plugin somewhere, but I keep forgetting which property file it is.
You can look at a recently added parameter, e.g. enableJava5Features, to
find out which file it is.

    Thomas


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




Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed.  If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you  please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.




RE: Adding torque.beanExtends property.

Posted by Thomas Fischer <fi...@seitenbau.net>.
"Greg Monroe" <Gr...@DukeCE.com> schrieb am 27.03.2007 16:12:38:

> Thomas Fischer wrote:
> > I'd be +1 for this as long as it also finds its way into
> > the maven 1 and maven 2 plugin.
>
> If it's just another build property setting, does anything
> special need to be for Maven 2?
>

I am afraid something special is needed for Maven 2. The parameter needs to
be read by the OMMojo from the plugin's configuration, and must write this
value into the property file which is then read by the TexenTask.
I know this is messy, but this happens because the generator is heavily
tied to ant, so one needs to simulate an ant environment inside the maven 2
plugin :-(.

Also, for the maven 1 plugin, you need to define a standard value if your
new property is not set. This needs to be done in a config file in the
maven 1 plugin somewhere, but I keep forgetting which property file it is.
You can look at a recently added parameter, e.g. enableJava5Features, to
find out which file it is.

    Thomas


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


RE: Adding torque.beanExtends property.

Posted by Greg Monroe <Gr...@DukeCE.com>.
Thomas Fischer wrote:
> I'd be +1 for this as long as it also finds its way into 
> the maven 1 and maven 2 plugin.

If it's just another build property setting, does anything 
special need to be for Maven 2?  

Thomas Vandahl wrote:
> Right you are. I was merely hinting that plain old Torque 
> objects could be used instead of beans. I'm not actually 
> changing something, I'm trying to use some of the "advanced" 
> features myself ;-)

FWIW, I considered that but it looked kind of messy to maintain,
especially since I'm currently limited to Struts 1.x. You'd have
to blend changes in the BaseObject with the Struts ActionForm 
object (or it's many variants).  Struts 2 seems to be more 
friendly about this sort of thing as I believe form beans just 
have to have set/get methods for the properties and may or may 
not impliment an interface.

Allowing the base bean class to be an extension of another 
class seemed like the clean way to do this.  And maybe 
eventually do a Torque template add-in to auto-create some
basic validation XML from the schema and/or some basic Struts
JSP forms (kind of like MyEclipse does if you use their 
form builder).


Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed.  If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you  please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited.



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


Re: Adding torque.beanExtends property.

Posted by Thomas Vandahl <tv...@apache.org>.
Thomas Fischer wrote:
> @Thomas V: If I get it correct, Greg wants to change the type hierarchy
> of the beans, whereas you want to change the type hierarchy of the
> database objects. So I'd guess Greg's changes will not interfere with
> your changes.

Right you are. I was merely hinting that plain old Torque objects could
be used instead of beans. I'm not actually changing something, I'm
trying to use some of the "advanced" features myself ;-)

Bye, Thomas.


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


Re: Adding torque.beanExtends property.

Posted by Thomas Fischer <tf...@apache.org>.
I'd be +1 for this as long as it also finds its way into the maven 1 and 
maven 2 plugin.

@Thomas V: If I get it correct, Greg wants to change the type hierarchy of 
the beans, whereas you want to change the type hierarchy of the database 
objects. So I'd guess Greg's changes will not interfere with your changes.

     Thomas

On Tue, 20 Mar 2007, Greg Monroe wrote:

> I've been working with a project that uses Struts and Torque recently
> and
> it struck me that if I could create Torque beans that extended one of
> the
> struts ActionForm classes, I'd get a whole set of Struts Form beans for
> free.
>
> In looking into this, it turned out to be trivial to add a
> "torque.beanExtends"
> property and modify the beans.vm template to use this if it is set.
>
> Anyone see any problems with this?  If not, I'll update the docs to
> include
> YACP (yet another config parameter) and check the change in.

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


Re: Adding torque.beanExtends property.

Posted by Thomas Vandahl <th...@tewisoft.de>.
Greg Monroe wrote:
> I've been working with a project that uses Struts and Torque recently
> and
> it struck me that if I could create Torque beans that extended one of
> the 
> struts ActionForm classes, I'd get a whole set of Struts Form beans for
> free.

I'm currently experimenting with the baseClass-Attribute of the table 
element in the Torque schema. This may or may not do what you want, 
directly with the Torque objects themselves. Note that the generated 
classes rely on a couple of methods from BaseObject that might need 
implementation, if you not directly extend BaseObject. I'd rather define 
some interface to do this but let's get to this later.

Bye, Thomas.


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