db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Monroe <mon...@dukece.com>
Subject RE: Working with BasePeer extensions
Date Mon, 09 Feb 2009 15:22:19 GMT
IMHO, it makes sense that if we supply a way to replace the default BasePeer
with your own class, that the templates should honor that replacement.  
Otherwise as Tal said, you can't override the static methods in the default
class.

If that is the case, I wonder if the BasePeer code shouldn't be refactored
to have BasePeer and BasePeerInstance classes, similar to the Torque and
TorqueInstance pair.  This would allow for static methods to be built on 
easily override-able instance methods. E.g. BasePeer.doSelect(...) would
do a getBasePeerInstance().doSelect(...) call.

To allow for custom BasePeerInstance classes, we'd probably need to move 
the class def from the generator properties to the runtime properties. Then
have the Torque init process populate the BasePeerInstance singleton with
the custom class in the properties.

On the plus side, the templates would not have to be re-done and all 
existing code that makes BasePeer callse would automatically pick up 
a custome BasePeerInstance.

A candidate for 4.0 work?

> -----Original Message-----
> From: Thomas Vandahl [mailto:tv@apache.org]
> Sent: Sunday, February 08, 2009 9:50 AM
> To: Apache Torque Developers List
> Subject: Re: Working with BasePeer extensions
> 
> Tal Kramer wrote:
> >    3.1 Wherever there was a direct reference to "BasePeer" in Peer.jm,
> > it was replaced by "${table.BasePeer}", e.g.
> >            return BasePeer.doInsert(criteria, con); >> return
> > ${table.BasePeer}.doInsert(criteria, con);
> 
> This kind of bothers me. Are you positive that these replacements were
> necessary? If so, that would mean to me that the use of direct BasePeer
> calls must be considered a bug in the templates. Opinions?
> 
> Bye, Thomas.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
> 

DukeCE 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


Mime
View raw message