Given an aggregate root X, which has many Y, and Y which has many Z...
How can I drill down through the associations and select only those X's whose Z's have a certain property value?
IList Xs = Session.CreateCriteria(typeof(X)) .CreateAlias("Ys", "Y") .CreateAlias("Y.Zs", "Z") .Add(Expression.Eq("Z.Property", 1)) .List();
Doing this results in a PropertyAccessException, and I have no idea why.
Loading all Xs and testing their Z properties would be massively redundant.