Hi!
When I look at the DTD of Hibernate 2.0 (
http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd) it says that the element "many-to-one" does not contain any attribute called lazy. Our experience with Hibernate 2.0 was that this made hibernate load the object referenced by this one-to-many relation in all cases. Configuring entity class with lazy="true" did not change that fact in our case. We may have done somthing else wrong, of course...
In Hibernate 3.0 the DTD (
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd) introduces a new attribute "lazy" on this element in the mapping file, which again makes Hibernate able to lazy load these types of associations (if the relation is modelled as "not null" in the ER-model - or ) using proxy objects. If the relation is nullable, then Hibernate loads the referenced object anyway.
From chapter 19.1.3 in Hibernate 3.0 documentation:
"By default, Hibernate3 generates proxies (at startup) for all persistent classes and uses them to enable lazy
fetching of many-to-one and one-to-one associations."
Of course I can have misunderstood something, but I am pretty sure this is how Hibernate 2.0 and 3.0 is working for this particular feature.
So, if the implementation of NHibernate 1.x confirmes to the 2.0 DTD, then NHibernate 1.0 and 1.2 will not support the feature I am requesting...(?) until NHibernate 3.0 is released...
-Jan Ivar