File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Question on JPQL... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Question on JPQL..." Watch "Question on JPQL..." New topic

Question on JPQL...

Ann Basso
Ranch Hand

Joined: Jul 26, 2007
Posts: 48
I need help in formulating a JPQL query in this situation:

1. I have Customer and Order entities and I want all the Customers who have ordered something. I am thinking:

select c from Customer c, In(c.orders) o

Is that correct? Would the query be different in EJBQL and JPQL for this situation?

2. What if I want all the customers who have an order that is larger than say 100$?

select c from Customer c, In(c.orders) o where o.amt>100

Any ideas?

Also, can someone point me to some resource that contains differences between EJBQL and JPQL?? I am really confused with both.
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

How about we move this to the more appropriate ORM forum, which covers JPA questions. Instead of it being linked from another thread you created in the ORM forum.


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

Joined: Oct 17, 2001
Posts: 153
Hi Ann,

Hope this article helps you -> JPQL

Shailesh Kini.
I agree. Here's the link:
subject: Question on JPQL...
It's not a secret anymore!