I have found several resources for eager loading of associations
without using joins:

1 - 
http://nhforge.org/blogs/nhibernate/archive/2008/09/06/eager-loading-aggregate-with-many-child-collections.aspx
2 - 
http://ayende.com/Blog/archive/2010/01/16/eagerly-loading-entity-associations-efficiently-with-nhibernate.aspx
3 - 
http://nhforge.org/blogs/nhibernate/archive/2008/09/06/lazy-loading-eager-loading.aspx

The first two articles use HQL to do either a Future<T>
or .CreateMultiCriteria() and both have a very severe problem. They
still join with the "parent" which results in very large resultsets
and unneeded data that is transfered redundantly.

The third article makes use of NHibernateUtil.Initialize(object) loads
the items but each .Initialize call results in a roundtrip to the
database.

Would be nice if at lease .Initialize(object) supported an array of
arguments but it would be even nicer when the criteria API would have
such a feature. As the way Entify Framework has in its API although I
am not really fond of their SQL query which has several UNION ALL's as
can be seen in Ayende's post.


In short:

I am now using NHibernateUtil.Initialize(object) after the query to
initialize all associations as fast as possible to make the
transaction as short as possible. There is currently no better
solution for cheap eager loading.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to