NHibernate - drilling from the root of the unit
Considering the aggregate root of X, which has many Y and Y, which has many Z ...
How can I expand the associations and select only those Xs where Z has a specific property value?
IList Xs = Session.CreateCriteria (typeof (X)) .CreateAlias ("Ys", "Y") .CreateAlias ("Y.Zs", "Z") .Add (Expression.Eq ("Z. Property ", 1)) .list ();
Doing so results in a PropertyAccessException, and I have no idea why.
Loading all X and testing their Z properties would be massively redundant.
0
Gary hall
a source
to share