0

I Have one-to-one relation in my NHibernate mapping:

<many-to-one name="PersonProfile" not-null="true"
    class="PersonProfile" column="profile" cascade="all" lazy="proxy"/>
...
<one-to-one name="Owner" class="Person" property-ref="PersonProfile" 
    constrained="true" lazy="proxy"/>

PersonProfile class have batch-size attribute set. When user.PersonProfile property is hit batch load triggers. But then, when Owner property is loaded it loads from database. Why?

Artem Tikhomirov
  • 21,497
  • 10
  • 48
  • 68

1 Answers1

0

Because one-to-one relations can not be lazy loaded (in some circumstances).

See this fine explanation: NHibernate: how to enable lazy loading on one-to-one mapping

Community
  • 1
  • 1
asgerhallas
  • 16,890
  • 6
  • 50
  • 68