Try for 3) results = CDPeer.doSelectJoinLocation(crit);
Then you can get the Location by
aCD = results.get(0);
aLocation = aCD.getLocation();
john mcnally
Saimon Moore wrote:
>
> Thanks for you help folks. I managed to insert allright, although I had to
> first save the location table
>
> aLocation.save();
>
> and then
>
> aCD.setLocation(aLocation);
> aCD.save();
>
> This works great!
>
> I have tried retrieving the same data using the following code
>
> <code>
> 1 Criteria criteria = new Criteria();
> 2 criteria.addJoin(CDPeer.LOCATION_ID, LocationPeer.LOCATION_ID );
> 3 return CDPeer.doSelect(criteria);
> </code>
> However, the result set only includes the CD table data and not as I expected
> both CD and Location.
>
> ie I'm getting SELECT CD FROM CD,LOCATION
> WHERE CD.LOCATION_ID = LOCATION.LOCATION_ID
>
> instead of
>
> ie SELECT * FROM CD,LOCATION
> WHERE CD.LOCATION_ID = LOCATION.LOCATION_ID
>
> If I change 3 for
>
> return LocationPeer.doSelect(criteria);
>
> I get only the Location data
>
> ie SELECT LOCATION FROM CD,LOCATION
> WHERE CD.LOCATION_ID = LOCATION.LOCATION_ID
>
> How can I define the pre-WHERE part of the sql statement?
>
> _________________________________________________________
>
> Do You Yahoo!?
>
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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]