-->
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.  [ 3 posts ] 
Author Message
 Post subject: Outerjoins in Criteria queries
PostPosted: Mon Oct 30, 2006 3:02 am 
Newbie

Joined: Fri Sep 30, 2005 12:45 am
Posts: 8
Hi,

I am trying to create Criteria query for a multiCriteria search functionality.

Code:
Criteria criteria  = session.createCriteria(CCase.class);
               .setFetchMode("caseGroupOwners", FetchMode.JOIN)                         .setFetchMode("caseGroupOwners.cGroup",FetchMode.JOIN);


Where CCase has a <set> caseGroupOwners (1-M relationship)
and caseGroupOwners has M-1 relationship with cGroup

CCase - caseGroupOwners - cGroup

However, when I use caseGroupOwners.cGroup in the setFetchMode clause, it does not resolve the property. It gives an exception that cGroup is not a property of CCase.

If we need to do outerjoins and if we have a M-M relationship as above what do we need to use? or how do we specify the above relationship in the setFetchMode?

Appreciate your feedback,
Thanks.


Top
 Profile  
 
 Post subject: do you have the mapping?
PostPosted: Tue Oct 31, 2006 8:41 pm 
Newbie

Joined: Fri Oct 27, 2006 6:53 pm
Posts: 3
Can you post the mapping for these associations? Also, have you tried creating an alias for caseGroupOwners like:
.createAlias("caseGroupOwners", "cGroupOwners")

and using:
.setFetchMode("cGroupOwners.cGroup",FetchMode.JOIN)
?

_________________
jim buswell


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 10, 2007 11:56 am 
Newbie

Joined: Fri Sep 30, 2005 12:45 am
Posts: 8
Creating alias helped,
Thanks!


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

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.