Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Criteria equivalent for select function

 
Mark Baldwin
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello masters,

I'd like to know if there is a Criteria equivalent for this SQL:

select * from productCategories where businessId = (select business_id from businesses where domain = ?) order by name desc limit ?, ?;

I think I know how to do it in HQL but if there's some way to do it with Criteria I would prefer that. Thanks

Kind regards,
Mark
 
James Sutherland
Ranch Hand
Posts: 553
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to write anything you can write in JPQL in Criteria.

Here is some examples of sub-queries using the Criteria API.

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/Criteria#Subquery
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic