How are you determining that lazy loading isn't happening? Diego
On Mon, Apr 19, 2010 at 09:44, Armin Landscheidt <[email protected]>wrote: > Hallo > > I'm loading an Object with a many-to-one association. When I load the > parent-object I would expect that the child is loaded lazy. But the > child ist loaded directly. How can this be? Is there a default which > could be set or something else? > > The mapping is like this: > > <class name="Parent" table="Parent" dynamic-update="true" lazy="true" > > > <id name="Id" unsaved-value="0"> > <generator class="native" /> > </id> > <property name="Name" not-null="true" /> > <many-to-one name="Child" column="ChildId" insert="false" > update="false" not-found="ignore" /> > </class> > > <class name="Child" table="Child" dynamic-update="true" lazy="true" > > <id name="Id" unsaved-value="0"> > <generator class="native" /> > </id> > <property name="Name" not-null="true" /> > </class> > > The Query: > var parent = session.CreateCriteria<Parent>() > .Add(Restrictions.Eq("Name", "myName")) > .UniqueResult<Parent>(); > > The properties are all virtual. If not NHibernate would throw an > exception. > Does anyone know a reason why the child is not lazy loaded? > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
