File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes EJB QL & CMR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "EJB QL & CMR" Watch "EJB QL & CMR" New topic
Author

EJB QL & CMR

Pally Gharmount
Ranch Hand

Joined: Aug 25, 2004
Posts: 34
I want to write a customised finder method for my CMP EJB. The EJB has a one to many relationship with another bean.

How can i write EJB-QL that will return results matching criteria in both beans..this is how i would do it in oracle....

SELECT *
FROM BGS.WELL_DATA A, BGS.SURF_DEPTHS B
WHERE A.WID=B.WID
AND A.WID=4
AND B.SOURCE='SH'
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
SELECT *
FROM BGS.WELL_DATA A, BGS.SURF_DEPTHS B
WHERE A.WID=B.WID
AND A.WID=4
AND B.SOURCE='SH'


It would be like this :

assuming its one to many relationship between tables WELL_DATA and SURF_DEPTHS and unidirectional from WELL_DATA to SURF_DEPTHS. In WELL_DATA CMP, we have a cmr field - surfdepths.

SELECT OBJECT(o) FROM schemaNameInWell_DataCMP o IN (o.surfdepths) y WHERE o.wid=?1 AND y.source=?2

where wid and source are cmp fields in both CMPs and finder method signature can be like :

findBySomeMethodName(Integer wid, String source)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB QL & CMR
 
Similar Threads
findByPrimaryKey in EJB QL
With EJB-QL, can I use ORDER BY clause?
how to delete database records in cmp?
where do we write EJB-QL in DD
Multiple column selection using EJB-QL