aspose file tools*
The moose likes Object Relational Mapping and the fly likes Criteria equivalent for select function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Criteria equivalent for select function" Watch "Criteria equivalent for select function" New topic
Author

Criteria equivalent for select function

Mark Baldwin
Greenhorn

Joined: Aug 04, 2011
Posts: 9
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

Joined: Oct 01, 2007
Posts: 553
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


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Criteria equivalent for select function
 
Similar Threads
Hibernate subquery
Possible to create this HQL equivalent using Hibernate Criteria?
hibernate withCriteria
inner query in hibernate
Hibernate query question