-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: one-to-none lazy loading fails - 1.2.0 Beta
PostPosted: Wed Nov 08, 2006 5:44 pm 
Newbie

Joined: Fri Nov 03, 2006 9:55 pm
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 3:16 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This has been fixed, the fix will be part of Beta2 that will be available in the next few days.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.