NHibernate: how to enable lazy loading on one-to-one mapping

后端 未结 5 1841
萌比男神i
萌比男神i 2020-12-03 11:22

One-to-one relations within nhibernate can be lazyloaded either \"false\" or \"proxy\". I was wondering if anyone knows a way to do a lazy one-to-one mapping.

I work

5条回答
  •  余生分开走
    2020-12-03 11:50

    I tried the example used by Artem Tikhomirov above. I kept getting an error that the Photo column does not exist. After looking at this, I figured out that the mapping was off a little. When I changed the many-to-one mapping to specify the column name like this:

    many-to-one name="Photo" column="PersonID" class="PersonPhoto" unique="true"

    I got it to work. I hope this helps someone :o)

提交回复
热议问题