I'm trying to eagerly load an entity with nested collections. As follows:
Parent -> Children1 -> GrandChild -> GreatGrandChildren
Here is one of my 4 attempts (this was the most promising):
Parent parent = null;
Child child = null;
GrandChild grandChild = null;
GreatGrandChild greatGreatChild = null;
var result = CurrentSession.QueryOver<Parend>(() => conj)
.Where(c => c.Id == id)
.JoinAlias(() => parent.Children, () => child)
.JoinAlias(() => child.GrandChild, () => grandChild)
.JoinAlias(() => grandChild.GreatGrandChildren , () => greatGrandChild)
.List<Parent>();
This generates the expected SQL, with lots of left outer joins. And also returns about 800 identical parents, due to the joins.
However, when i access the lists of the first parent via code in a for loop, the DB is hit countless times, completely ignoring the previous query.
Any ideas?
Info: NHibernate 3.3; DB: Oracle; VS2012 - ASP.NET
Thanks