• 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

EJBQL PROBLEMS

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic