This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBQL PROBLEMS  RSS feed

 
Ranga Rao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!