• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB-QL Question

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the correct local home definition and it's deployment descriptor?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic