-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Is this a Hibernate Criteria API limitation??
PostPosted: Thu Sep 08, 2011 6:52 am 
Newbie

Joined: Fri Sep 02, 2011 3:47 am
Posts: 2
I have 4 entities in a Hierarchy like this:

Code:
               Entity1
                  |
       ------------------------
       |          |           |
   Entity2     Entity3    Entity4


And I am interested in retrieving All the instances of Entity2 and Entity3, but not Entity4 instances) with a criteria in a single Query.

This is easy to do with HQL as follows:

Code:
FROM Entity_1 obj 
WHERE obj IN (FROM Entity2) OR   
      obj IN (FROM Entity3)


But after a deep study of Hibernate Criteria API, I cannot find a way to express this HQL query as a Criteria.

Is this a limitation of Criteria API? Or is it just that i didn't find how to do it?
Thank you in advance!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.