I have a problem with SetFetchMode call in Criteria API in following query:
DetachedCriteria.For()
.Add(u => u.Sta
The solution is not so obvious. We have changed
.CreateAlias("Companies", "comp")
to
.CreateAlias("Companies", "comp", JoinType.LeftOuterJoin)
Since you are using .CreateAlias("Companies", "comp")
, NHibernate can't eager-load the collection, as you could be using restrictions on that alias.
My overall suggestion is to never use eager load on collections. Use batch_size
or this trick instead.