Hi, Thanks for you answer but unfortunately this wasn't the issue I'm trying to solve. My issue is that I'd like to make a query with filtering on a related table, but only retrieve the root table rows. This can be done with HQL, but I haven't figured out how to do it with the Criteria API, I'm not even sure there is a way.
Cheers On 24 Jan, 13:31, simona_85 <[email protected]> wrote: > If I Understood u well, I think that this is the way: > > IList<Parent> list = > session.CreateCriteria<Parent>().CreateAlias("Children","children"). > (Restrictions.Eq("childer.Gender", "male")).SetResultTransformer(new > DistinctRootEntityResultTransformer()).List<list>(); > > And Children in CreateAlias is your collection from Parent... > > On 21 јан, 23:50, Neo <[email protected]> wrote: > > > > > > > > > Hi, > > > I'm trying to catch up with the Criteria API and can't seem to figure > > out how do the following HQL query using the Criteria API: > > > "select p from Parent p left join p.Children c where c.gender = > > 'male'" > > > and my problem is the "select p" part, can't figure out how to do this > > with Criteria without also fetching the children. > > > Cheers! -- 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.
