I have the following query:
ObjectB objectBAlias = null;
ObjectC objectCAlias = null;
var query = session.QueryOver();
var results = query
.Jo
I would suggest - do not try that (eager loading of many-to-many). Instead - use built in feature:
19.1.5. Using batch fetching
NHibernate can make efficient use of batch fetching, that is, NHibernate can load several uninitialized proxies if one proxy is accessed (or collections. Batch fetching is an optimization of the lazy select fetching strategy. There are two ways you can tune batch fetching: on the class and the collection level.
To get more details check these:
Fetching Collections is a difficult operation. It has many side effects (as you realized, when there are fetched more collections). But even with fetching one collection, we are loading many duplicated rows.