Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CMR, and EJB QL question

 
John Marchesino
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am having some problems while using cmr mapping along with a ejb ql join.

Here is my situation.

I have a table that maps to many other tables through cmr mapping. In other words I have a parent table or Entity Bean with many child tables or child Entity beans.

The parent table is named OutageRequest

When I do a straight forward FindBYPrimaryKey I get the the OutageRequest Entity Bean back and I am able to access all of its children throught the relevent getter methods

When I run a ejb query that joins a child table with the OutageRequest(parent) table to filter my query results I run into my problem. I get the OutageRequest EJB back but I am unable to access any of its child Entity Beans. In other words I can get data back form the rows returned in the OutageRequest table but I cannot access the data form any of its child tables. Here is an example of the query I am using.

<![CDATA[SELECT DISTINCT OBJECT(a) FROM OutageRequestEJB AS a
WHERE a.outageDates.startDateTime BETWEEN ?1 AND ?2]]>

OutageRequestEJB is the parent bean. outageDates is one of its many child elements. OutageRequestEJB and outage dates have a one to many bi-directional relationship.


I have been struggling with this problem for days. Any insight would greatly appreciated.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic