db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Few general questions regarding Torque
Date Wed, 19 Oct 2005 17:59:56 GMT
> From: Asaf Shakarchi
> 1)       Is it possible to retrieve a primary key by basePeer 
> object? We
> like to do something like 'basePeer newBase = new 
> OneOfTheDataObjectPeer()' and then call basePeer.retrieveByPK 
> which will return a baseobject, it seems that all 
> retryeveByPK functions are generated per peer child but maybe 
> there's still away to do it? :-/

AFAIK, this is not currently possible.

If you really need this functionality, you can define your own 
interface/methods for an Object myRetrieveByPK method in the 
Peer class stubs and use the interface instead of BasePeer. Of 
course you know that eventually, you'll need to cast the result 
into the correct data object to use the data retrieved.  (If 
you need it in a lot of tables, look at a custom mod of the 

If someone wanted to add this functionality to Torque, a set of
of non-functional methods that return BaseObjects would have to 
be added to the BasePeer object and the templates changed to 
include these when specific Table data objects are created.

> 2)       Since I still can't figure out how to do adjoin with 
> 'OR" condition
> instead of 'AND', is there a way just to execute a full query 
> instead of using criteria to generate my query?

The Criteria experts may help on the "right" way, but a quick way
to do this might be to look at the Criteria.CUSTOM functions.  This
is a way to add straight SQL selection statements into the criteria.
(See the CUSTOM comparitor example in the Criteria HOWTO).

> 3)       If I have an instance of a DataObject, is there a 
> way to retrieve
> by the DataObject the corresponding peerObject and vice versa?

Look at the getPeer() method in the table data object and getOMClass() 
in the Table Peer object.

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-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message