-
1. Re: Problem with EJB-QL parsing
dsundstrom Jul 15, 2002 3:21 PM (in response to jsimone)You have:
SELECT OBJECT(s) FROM Event AS e WHERE e.id = ?1,
IN (e.programs) AS p,
IN (p.tracks) AS t,
IN (t.courses) AS c,
IN (c.sessions) AS s
Try this:
SELECT OBJECT(s)
FROM
Event AS e,
IN (e.programs) AS p,
IN (p.tracks) AS t,
IN (t.courses) AS c,
IN (c.sessions) AS s
WHERE e.id = ?1 -
2. Re: Problem with EJB-QL parsing
jsimone Jul 16, 2002 10:16 PM (in response to jsimone)Thanks!
I get a clean deployment now!
BUT, if I call the query on the EventLocalHome interface, where its defined as:
public Collection findSessions(String eventId)
throws FinderException;
With the following method :
public ArrayList listSessionsByEvent(String eventId) {
Collection sessions = null;
ArrayList empty = new ArrayList();
try {
sessions = eventLocalHome.findSessions(eventId);
}
catch (Exception ex) {
throw new EJBException(ex.getMessage());
}
System.out.println(sessions.size()+" **************");
Iterator i = sessions.iterator();
while (i.hasNext()) {
SessionLocal session= (SessionLocal) i.next();
System.out.println(session.getPrimaryKey()+" ******");
}
return empty;
}
I get 81 as the number of objects returned, which correct. BUT I don't get SessionLocals beans back! In fact, I get an exception on the getPrimaryKey() -- so these returned objects are not bean references??
I am confused as to what is actually coming back from the query now.
Thanks for help in advance!
It is much appreciated.
joe
P.S. If I grab the query from server.log - the last line before the exception, which represents the EJB-QL and issue it against the DB as a SQL query I do get 81 primary keys returned. -
3. Re: Problem with EJB-QL parsing
jsimone Jul 17, 2002 10:16 AM (in response to jsimone)Oops! I found my problem. I was expecting a collection of sessions from my EventLocal interface. I put the query in the SessionLocal entity and the query works perfectly now.
Thanks for your help Dain.
regards,
joe -
4. Re: Problem with EJB-QL parsing
lkmanda Aug 2, 2002 5:50 PM (in response to jsimone)i have the same situation here . I could get everything inot collection but at the same time they are not interfaces iam gettign
iam getting collection of strings like "someCMR field:Id" like "emsLocal:1023"
How did u manage to get the Local Remote Interfaces etc.
I tried moving the query to the down level ., It is getting the collection, but it doesnot solely contain either the remoteInterface or PrimaryKey. but it contains some Cmr field followed by :Primary Key.
Do we need to parse for key and again regenerate REmote Interface..
ur response is appreciated/
Thanks
Leela -
5. Re: Problem with EJB-QL parsing
dsundstrom Aug 6, 2002 1:55 PM (in response to jsimone)Finders on the RemoteHome return a collection of Remote entities and finders on the LocalHome return a collection of Local entities. If you want remote entities call the finder on the remote home.