db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CP Lim <cp_...@redsheriff.com>
Subject Re: Foreign Key
Date Mon, 20 Jan 2003 05:17:04 GMT
Hi Michael,

I'm guessing you're trying to get the data from Table 2.  So the 
following would be all that's required (I think):

Criteria criteria = new Criteria();
criteria.add(Table1Peer.ID, <your constraint here>);
criteria.addJoin(Table1Peer.ID, Table2Peer.Col_C);
criteria.addJoin(Table1Peer.ID, Table2Peer.Col_D);

List result = Table2Peer.doSelect(criteria);

HTH,
CP


Eigen Technology Pty Ltd wrote:
> Hi...
> 
> If a table has two columns which are related to another table, can I Join
> them using Foreign Key, if so, how could I do it?
> 
> Table 1
> ID
> Col_A
> Col_B
> 
> Table 2
> ID
> Col_C   <----  need to link to ID in table_1
> Col_D   <----  also need to link to ID in table_1
> 
> thanks
> michael
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-torque-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-torque-user-help@jakarta.apache.org>
> 
> 
> 


-- 
R E D S H E R I F F
C.P. Lim - Software Engineer
Level 1, 10 Queens Road    +61 3 9864 0733 tel
Melbourne VIC              +61 3 9864 0778 fax
Australia                  +61 413 781 846 mob

This message and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient, you are hereby 
notified that any use or dissemination of this communication is strictly 
prohibited. If you have received this message in error please notify us 
immediately by return email or telephone +61 (3) 9659 0432, then delete 
this message. Any views expressed in this message are those of the 
individual sender and many not necessarily reflect the views of Red 
Sheriff.


Mime
View raw message