Hi,

AFAIK it is always generated, but I haven't changed my torque.props for
quite some time now, so I might be wrong.

~ Leon

----- Original Message -----
From: "Diethelm Guallar, Gonzalo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 13, 2001 2:31 PM
Subject: RE: Join example


> > > Thanks Jon, my question was a little deeper than that... 8-)
> > > If I do what you say, then how do I retrieve the rows? Is there
> > > any difference between
> > >
> > >   Vector A = TABLEA.doSelect(crit); // (1)
> > >
> > > and
> > >
> > >   Vector B = TABLEB.doSelect(crit); // (2)
> > >
> > > That's what I meant by configuring torque to support this...
> > > I'm guessing that, after doing (1), I could ask for the TABLEB
> > > object implicitly pointed to by the TABLEA peer I got back?
> > >
> > >   TABLEA pa = A.elementAt(0);  // pa is a peer for table A
> > >   TABLEB pb = pa.getB();       // or some such?
> >
> > Just remember that this second line will result in another db
> > hit.  If you
> > want all both TABLEA and TABLEB elements to be selected at
> > the same time you
> > should do something like this:
> >
> > Criteria crit = new Criteria();
> > crit.add (TABLEA.id, TABLEB.id);
> > List aObjects = TableAPeer.doSelectJoinTableB (crit);
> >
> > Now a single query is executed and both TABLEA and TABLEB objects are
> > constructed from the resultset.  Now calling pa.getB() does
> > not result in
> > another database hit, but the object is retrieved from memory.
>
> Great! Thanks Leon, that's exactly what I was after. Now, is the
> method doSelectJoinTableB() always generated (based on the foreign
> keys), or do I have to set a special property for torque?
>
> Thanks again,
>
> > ~ Leon
>
>
> --
> 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]

Reply via email to