views:

196

answers:

1

I'm using nhibernate to load parent class in a not lazy way and I have many-to-many set of child class that I want to determine in run time rather to load it lazy or not. I'm using .hbm.xml mapping and I tried to change the set "lazy" property after loading the assemblies, is it possible?

+1  A: 

I think the best (only) way is to set lazy=false and then in your HQL use "join fetch" or in criterias use SetFetchMode on a collection that needs to be eagerly retrieved.

Read more here: http://ayende.com/Blog/archive/2006/05/02/CombatingTheSelectN1ProblemInNHibernate.aspx

/Asger

asgerhallas