The moose likes EJB and Other Java EE Technologies and the fly likes EJBQL PROBLEMS Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "EJBQL PROBLEMS" Watch "EJBQL PROBLEMS" New topic
Author

EJBQL PROBLEMS

Ranga Rao
Greenhorn

Joined: Nov 05, 2001
Posts: 4
Hey
Can anybody help on these issues related to EJB QL in Weblogic 6.0 SP1
1. Can I use COUNT function in EJB QL. If not what is the work around. Refer Query1
2. Can I use NESTED queries in EJB QL. If not what is the work around. Refer Query1 & Query2
3. Can I use MAX function in EJBQL. If not what is the work around. Refer Query2
4. Can I use ORDER BY DESC in EJB QL. If not what is the work around. Refer Query3
Query1
select * from ClaimBeanTbl t1, ClaimSpecialistsBeanTbl t2
where t1.objId = t2.claimObjId
and t2.specialistObjId = ?
and t2.endDate = 'empty'
and (select count (*) from ClaimSpecialistsBeanTbl
where claimObjId = t1.objId) = 1
and t2.isNew = 1
Query2
select a.objid from paymentbeantbl a
where a.claimobjid = ?
and a.paymentdate =
(select max (b.paymentdate) from PaymentBeantbl b where b.claimobjid = ?)

Query3
select a.objid from paymentbeantbl a where a.claimobjid = ? order by a.paymentdate DESC
The restrictions/limitations of EJB QL are too rigid. We expected EJB 2.0 and in turn EJB QL will ease the process of development but it is indeed giving us tough times and is a REAL NIGHTMARE. I wonder whether shifting from EJB 1.1 to EJB 2.0 is the right decision in such circumstances.
Any help on this will be highly appreciated.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Just because you have switched from 1.1 to 2.0 doesn't mean you lose any functionality that was available in 1.1!!! How would you have done the above functions in 1.1? With BMP or session beans invoking JDBC. Well, guess what? You can do the exact same thing in 2.0! EJBQL has some severe limitations that will hopefully be improved upon in future releases. But it doesn't hurt anything having it there!
BTW, it seems to me that if you are trying to use the above queries to create entity beans that your design is flawed. Complex inter-entity relationships are a very poor candidate for entity beans. Why not just create java objects from a session bean?
------------------
Tom
Sun Certified Programmer for the Java� 2 Platform
Moderator of the forums:
J2EE and EJB
Other Java APIs


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
 
subject: EJBQL PROBLEMS
 
Threads others viewed
database query
find & Select
Problem in viewing records ?
retrieve data from huge result set
EJBQL PROBLEMS
developer file tools