A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
Criteria equivalent for select function
Joined: Aug 04, 2011
Oct 10, 2012 20:57:58
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
Joined: Oct 01, 2007
Oct 11, 2012 06:42:31
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.
Blog:Java Persistence Performance
It is sorta covered in the
JavaRanch Style Guide
subject: Criteria equivalent for select function
Possible to create this HQL equivalent using Hibernate Criteria?
inner query in hibernate
Hibernate query question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015