Hello

[ I asked the same thing there:
http://stackoverflow.com/questions/1861537/nhibernate-how-to-retrieve-an-entity-that-has-all-entities-with-a-certain-pred]

I have an Article with a Set of Category. How can I query, using the
criteria interface, for all Articles that contain all Categories with a
certain Id?

This is not an "in", I need exclusively those who have *all* necessary
categories - and others. Partial matches should not come in there.

Currently my code is failing with this desperate attempt:

var c = session.CreateCriteria<Article>("a");
if (categoryKeys.HasItems())
{
    c.CreateAlias("a.Categories", "c");
    foreach (var key in categoryKeys)
        c.Add(Restrictions.Eq("c", key)); //bogus, I know!
}

Anyone can give me a quick help?

-- 
Jan

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to