Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes EJB-QL Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB-QL Question" Watch "EJB-QL Question" New topic
Author

EJB-QL Question

Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
I am having problems with finder methods on the home interface returning the correct values. For example i have a Client entity bean setup and a Contact entity bean setup. I have a 1 to many relationship between the two, the client is the 1 and the contact is the many. I am trying to run a simple EJB-QL statement and return all Contact entity objects to work with the data. When I run the query it seems to return the right number of entity beans but they are of the wrong type so when I cast them to the proper type my application fails and throw an exception. After debuging with Eclipse it appears that the entity objects being return are Client entity beans instead of the Contact entity beans which are supossed to be returned. Below is application deployment and query.

Envionment:
AppServer: JBoss 3.2.5

EJB-QL: Select Object(co) FROM Client AS c, IN (c.contacts) AS co;

Deployment descriptors

ejb-jar.xml:

Client descriptor


Contact descriptor:


relationship descriptor:


Client Code (In a session bean)


Thanks for your help. Once I get past this hurdle I think I will have a much better understanding of what I am doing wrong.
Sloan Bowman
Ranch Hand

Joined: Jan 21, 2003
Posts: 107
For those of you interested the problem I was facing was being stupid and forgetting that finder methods only return the native local of the object. I converted these queries to select methods and used the selcts in the entity bean business method and it worked like a champ.
Bruce Sheng
Greenhorn

Joined: Feb 13, 2003
Posts: 4
Can you post the correct local home definition and it's deployment descriptor?


Sleep is true,and clear-head is false!
 
wood burning stoves
 
subject: EJB-QL Question
 
Similar Threads
Error in ejb-jar.xml
weblogic mapping with Oracle failed
Help me out for CMR deployment in CMP EJB......
EJB PK class
CMR configuration confusion