File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes How to do orderBy with EJB (CMP)?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to do orderBy with EJB (CMP)??" Watch "How to do orderBy with EJB (CMP)??" New topic

How to do orderBy with EJB (CMP)??

Long Huynh

Joined: Jul 14, 2002
Posts: 7
What is the correct statement to do orderBy in Oracle9i dev with EJB (CMP)?? I know this is possible with EJB (BMP).

[ July 25, 2002: Message edited by: Long Huynh ]

Long A. Huynh ( yes, as in the primitive 64 bit<br />SCJP2<br />"Got Java?"
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

I am going to move this thread to a more appropriate forum, so that you can get answers quicker.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
In EJB 2.0 CMP, you specify the query in ejb-jar.xml using EJB-QL. There is no ORDER BY in EJB-QL (yet - it is coming in EJB 2.1).
I know that Weblogic has an extention to EJB-QL that includes an ORDERBY keyword. Other appservers may do something similar, but I don't know.
If the ordering is important, you are stuck with BMP. Or you could do the ordering on the client using an appropriate Comparator with the Collection returned by the finder. Ugh.
Siva Jagadeesan
Ranch Hand

Joined: Oct 31, 2000
Posts: 160
Yes Dave is correct.
Order By is introduced in the EJB1.3
Chk the EJB 1.3 public draft

Rgds<p>--Siva Jagadeesan<br /><a href="" target="_blank" rel="nofollow"></a><br />Sun Certified Java2 Programmer<br />Sun Certified Web Component Developer<br />BEA Certified Weblogic Server 7 Enterprise Developer
I agree. Here's the link:
subject: How to do orderBy with EJB (CMP)??
It's not a secret anymore!