If you are using torque generated objects with a foreign key arrangement
<table TONE>
<fk TTWO>
<reference COLP COLP/>
<reference COLQ COLQ/>
</fk>
</table>
> Criteria ct = new Criteria();
> ct.add(TonePeer.COLY, valueY);
> ct.add(TtwoPeer.COLZ, valueZ);
> Vector v = TonePeer.doSelectJoinTtwo(ct);
would provide you with a List of Tone objects. A Tone object has a
method getTtwo() which returns the Ttwo object.
john mcnally
"Diethelm Guallar, Gonzalo" wrote:
>
> If I use Criteria to do a join between two tables,
> what is the standard mechanism to differentiate
> between columns of same name and different tables?
> For example:
>
> Criteria ct = new Criteria();
> ct.addSelectColumn(TonePeer.COLX);
> ct.addSelectColumn(TtwoPeer.COLX);
> ct.add(TonePeer.COLY, valueY);
> ct.add(TtwoPeer.COLZ, valueZ);
> ct.addJoin(TonePeer.COLP, TtwoPeer.COLP);
> ct.addJoin(TonePeer.COLQ, TtwoPeer.COLQ);
> Vector v = TonePeer.doSelect(ct);
>
> In this example, the values for COLX in each table are
> different.
>
> How do I ask for COLX in Tone, or COLX in Ttwo, from v?
> In fact, what exactly is the type of each object that
> gets placed in Vector v Are they Tone objects? Also,
> is it any different if I do
>
> Vector v = TtwoPeer.doSelect(ct);
>
> In this case, the type of each object in Vector v would
> be Ttwo? And if this is the case, how would I get the
> values for all of Tone's columns placed in the select?
>
> Thanks,
>
> --
> Gonzalo A. Diethelm
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]