-->
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.  [ 1 post ] 
Author Message
 Post subject: LazyInitializationException when using fetch="join"
PostPosted: Tue Oct 24, 2006 1:12 pm 
Newbie

Joined: Tue Oct 24, 2006 1:06 pm
Posts: 1
I'm using NHibernate version 1.2.0.Beta1 and have a simple one-many relationship defined roughly like this:


<class name="Parent" table="parent" lazy="false" mutable="false">
<id column="parent_id" name="ParentID" type="Int32">
<generator class="identity" />
</id>
<list name="ChildList" table="children" lazy="false" fetch="join">
<key column="parent_id" />
<index column="idx" />
<one-to-many class="Child"/>
</list>
</class>

<class name="Child" table="exceptions" lazy="false" mutable="false" >
<id column="child_id" name="ChildID" type="Int32">
<generator class="identity" />
</id>
<!-- properties -->
</class>

When I first tried this mapping I did not use fetch="join" on the collection and everything was working fine, but the iterative queries were simply too expensive. However, when I added the fetch="join" argument, I started seeing a LazyInitializationException inside of the ChildList property setter. The setter called the Count method of the collection and was getting the error "cannot access loading collection".

This one has me a bit stumped.. any advice would be appreciated.


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

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.