El Vie 06 Jul 2001 22:49, escribiste:
> Try for 3) results = CDPeer.doSelectJoinLocation(crit);
>
> Then you can get the Location by
>
> aCD = results.get(0);
> aLocation = aCD.getLocation();
>
> john mcnally
>

The compiler complains about 'CDPeer.doSelectJoinLocation(crit)'
being a protected method.

 [javac] 
/home/saimon/tdk/webapps/newapp/WEB-INF/src/java/org/mycompany/newapp/modules/screens/CdAdminView.java:106:
 
doSelectJoinLocation(org.apache.turbine.util.db.Criteria) has protected 
access in org.mycompany.newapp.om.BaseCDPeer
    [javac]             results = CDPeer.doSelectJoinLocation(criteria);
    [javac]                          ^
    [javac] 1 error    

I'm writing a method to add the results to the context within a screen 
class, which is not of the same package as the doSelectJoinLocation method. 
So should I define it in a public method within CDPeer and call it from 
within my screen class.


One other thing, 
Am I right in saying that from, what I can understand, your code provides the 
Location for the first 1st row of the CD resultset. Does the 
doSelectJoinLocation() method give you all the cd and their corresponding 
location objects?


> 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]

_________________________________________________________
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]

Reply via email to