-->
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.  [ 3 posts ] 
Author Message
 Post subject: problems with lazy access
PostPosted: Wed Oct 05, 2005 5:06 am 
Newbie

Joined: Wed Oct 05, 2005 4:51 am
Posts: 3
Location: Cardiff
Hi,
I am getting the following exception when trying to access a lazy set in my code
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.foo.model.Bar.barSets - no session or session was closed
My Bar.hmb.xml file contains the following
<!-- bi-directional one-to-many association to BarSets -->
<set
name="barSets"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="BAR_ID" />
</key>
<one-to-many
class="com.epitiro.dao.model.BarSet"
/>
</set>

When I set lazy to false this works fine. Is there something else I need to configure to make the lazy work?

Thanks,


Simon


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 05, 2005 7:43 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 4:20 am
Posts: 40
Location: Vienna
Hi,
this exception occurs when you close your session before the lazy loading has taken place.
So just make sure that you only close the session AFTER all data has been loaded.

regards
Stefan


Top
 Profile  
 
 Post subject: Re: problems with lazy access
PostPosted: Wed Oct 05, 2005 8:04 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
You should have also found hundreds of other posts on this topic which would have answered your question.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.