-->
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: ICriteria with objects in many-to-many bag collections
PostPosted: Tue May 31, 2005 8:16 am 
Newbie

Joined: Tue May 31, 2005 8:02 am
Posts: 1
I have an object with a number of fields mapped like so:

<bag name="Responsible" table="responsible">
<key column="objectid" />
<many-to-many class="Hshsl.Credential,Hshsl.Credentials" column="userid" />
</bag>

The object has many lists of what basically represent 'users' or 'groups' for different roles.

Object
.Responsible (IList) - filled with Credential's
.Interested (IList) - same ..

Credential base class (User or Group)
.Id

There are instances where I would like to query for Object where a specific user or group in a list, and I am able to search for them in one list like:

select o from Object o join o.Responsible r where r.Id in (1,5,6)

Where the numbers are a list of the userid's I am looking for.

However
a) I prefer using the ICriteria pattern, and I am for every other query
b) I have not been able to figure out how to query 2+ bags simultaneously either (which I'd imagine is easy if I could figure out a criteria way)

How might I go about doing this using ICriteria and Expression? I have had absolutely no luck figuring it out, and it's probably obvious to someone with more NHibernate experience, after understanding what I'm wanting.

Thanks for assisting this noob :)


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.