I'm having difficulties constructing a criteria typed query.
Let's say we have a Hierarchy class with 2 properties called Parent and Child of a certain class, Foo for instance. The Foo class has no knowledge of Hierarchy.
I want to query the Hierarchy class to find all childs with a certain parent.
Code:
ICriteria criteria = session.CreateCriteria(typeof(Hierarchy));
criteria.Add(Expression.Eq("Parent", parent));
This would return all the Hierarchy objects with the parent, but I want a list of Foo. (without looping through the Hierarchy objects and filtering the childs out)
But for the love of God, I can't figure out how, I've been fooling around with Projections and ResultTransformers, without success.