Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Criteria equivalent for select function

 
Mark Baldwin
Greenhorn
Posts: 9
  • 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
  • Likes 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic