I worked in a project where we had to use NHibernate's lazy properties feature. Our mapping class was perfectly fit for this feature, but NHibernate assembled the SQL queries along with the lazy columns (thus, the properties were eagerly loaded). To identify this problem, we logged NHibernate's Tuple.Entity namespace. The following entry is relevant:
"Disabled lazy properies fetching for XXXXX.XXX beacuse it does not support lazy at the entity level".
Support for lazy properties is determined according to the lazyAvailable variable in the EntityMetamodel class. This variable was always false because Spring.NET used ProxyFactoryFactory. Its IsInstrumented method implementation always returns false. To overcome this problem, we decided to set the proxyfactory.factory_class key in NHibernate's properties to NHibernate.Bytecode.DefaultProxyFactoryFactory (where the return of IsInstrumented method always returns true).
Shouldn't Spring.NET let NHibernate use its default DefaultProxyFactoryFactory class when the key isn't explicitly set?
In order to help out developers who may face this problem, we decided to post this issue on jira.