Fixed
Details
Details
Assignee
Unassigned
UnassignedReporter
Not My Full Name
Not My Full NameComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created March 1, 2010 at 6:29 AM
Updated December 4, 2010 at 3:37 PM
Resolved July 21, 2010 at 1:47 PM
http://nhforge.org/doc/nh/en/index.html#querycriteria-associations
In chapter 14.4. Associations:
Note that the kittens collections held by the Cat instances returned by the previous two queries are not pre-filtered by the criteria! If you wish to retrieve just the kittens that match the criteria, you must use SetResultTransformer(CriteriaUtil.AliasToEntityMap).
IList cats = sess.CreateCriteria(typeof(Cat))
.CreateCriteria("Kittens", "kt")
.Add( Expression.Eq("Name", "F%") )
.SetResultTransformer(CriteriaUtil.AliasToEntityMap)
.List();
foreach ( IDictionary map in cats )
{
Cat cat = (Cat) map[CriteriaUtil.RootAlias];
Cat kitten = (Cat) map["kt"];
}