From: Boyan T. (JIRA) <nh...@gm...> - 2011-05-19 08:34:51
|
Lazy="proxy" does eager load on one-to-one relation through PK -------------------------------------------------------------- Key: NH-2715 URL: http://216.121.112.228/browse/NH-2715 Project: NHibernate Issue Type: Bug Components: Core Affects Versions: 3.2.0Beta1 Reporter: Boyan Trushev Priority: Minor Hi, This is a follow-up of the problem I described in #NH-2704. There I found that when one-to-one relation is through FK the related property is eagerly loaded. I have been told that this is an expected behavior for one-to-one relation through FK, so I decided to examine also the case when the one-to-one relation is through PK. I have found the same problem there too. It can be easily reproduced with the LazyOneToOne test case. You just have to change lazy="no-proxy" to lazy="proxy" for Employee property of the Person class and for Person property of Employee class in Person.hbm.xml and run the Lazy() test. You'll notice that both the person and it's employee property are loaded on: p = s.CreateQuery("from Person where name='Gavin'").UniqueResult<Person>(); And on the next line the test fails as the Employee property was alredy loaded: Assert.That(!NHibernateUtil.IsPropertyInitialized(p, "Employee")); -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |