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 :)
|