This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes Hibernate subquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate subquery" Watch "Hibernate subquery" New topic

Hibernate subquery

Johan den Boer

Joined: Apr 08, 2008
Posts: 18

How can I do this query in hibernate using criteria, projections, restrictions

select * from my_table where id = (select id from other_table where name = 'abc')

thanks a lot


Johan<br /> <br />scjp, scjd
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

The HQL is not that different. What have you tried?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Hibernate subquery