Hi - I'm using 1.2.0 beta, and gradually making classes lazy load. I discovered that when a one-to-one is lazy loaded, the proxy loader will throw an exception if it turns out there is nothing to load, a one-to-none. If I make the one-to-one class not lazy, the one-to-none mapping works as expected, with the object reference being null.
Is this expected and intended behavior?
If logs are needed, I will post them.
Thanks in advance.
Below are the mapping docs - the EmployeeChanges class has the problem with the lazy one-to-none.
Hibernate version: 1.2.0 Beta 1
Mapping documents:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="S3TS.CBMS.Clients.EmployeeChanges, S3TS.CBMS" table="CBM_EmployeeLogin">
<id name="UserID" column="User_ID" unsaved-value="0" access="field.camelcase-underscore">
<generator class="native"/>
</id>
<many-to-one name="Client" column="Client_Code" class="S3TS.CBMS.Clients.Client, S3TS.CBMS" access="field.camelcase-underscore"/>
<one-to-one name="PendingEnrollRuleSelection" access="field.camelcase-underscore" cascade="all-delete-orphan"/>
</class>
</hibernate-mapping>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="S3TS.CBMS.Clients.PendingEnrollRuleSelection, S3TS.CBMS" table="CBM_PendingEmployeeEnrollRule" where="System_Approved = 0">
<id name="SelectionID" column="User_ID" access="field.camelcase-underscore">
<generator class="foreign">
<param name="property">EmployeeChanges</param>
</generator>
</id>
<one-to-one name="EmployeeChanges" class="S3TS.CBMS.Clients.EmployeeChanges, S3TS.CBMS" access="field.camelcase-underscore" constrained="true"/>
<many-to-one name="ClientEnrollRule" class="S3TS.CBMS.Clients.ClientEnrollRule, S3TS.CBMS" column="Rule_ID" access="field.camelcase-underscore"/>
<property name="EffectiveFrom" column="Eff_From" access="field.camelcase-underscore"/>
<property name="SelectedBy" column="SelectedBy" />
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
{"No row with the given identifier exists: 16520, of class: S3TS.CBMS.Clients.PendingEnrollRuleSelection"}
at NHibernate.Proxy.LazyInitializer.CheckTargetState() in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Proxy\LazyInitializer.cs:line 104
at NHibernate.Proxy.LazyInitializer.Initialize() in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Proxy\LazyInitializer.cs:line 90
at NHibernate.Proxy.LazyInitializer.GetImplementation() in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Proxy\LazyInitializer.cs:line 240
at NHibernate.Proxy.CastleLazyInitializer.Intercept(IInvocation invocation, Object[] args) in c:\net\nhibernate-1.2.0.Beta1\nhibernate\src\NHibernate\Proxy\CastleLazyInitializer.cs:line 59
at CProxyTypePendingEnrollRuleSelectionClients_INHibernateProxy1.ValidRuleForPeriod(DateTime period)
at S3TS.CBMS.Clients.EmployeeChanges.GetSelectedRuleForPeriod(DateTime period)
Name and version of the database you are using:
SQL 2005 Standard
|