-->
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: Failed to lazily initialize a collection
PostPosted: Wed Jul 21, 2004 7:56 pm 
Newbie

Joined: Wed Jul 21, 2004 7:12 pm
Posts: 1
I am having a problem with hibernate lazy collection initialization. When I call some method on a lazy initialized collection, size() or add(), it always throws out the LazyInitializationException. I set the "lazy" attribute in Set value "true" and "inverse" attribute "true" and "cascade" attribute "save-update". I debug into the Hibernate code and found the exception is throw on the statement "session.afterLoad();" in the "doQueryAndInitializeNonLazyCollections" method in Loader class. But the inner exception seems to be "ClassCastException" which is caught in the "initialize" method in "PersistentCollection" class. I am just confused about this.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 3:38 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You have to have an open Session if you want to access an unitialized collection.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 4:39 am 
Beginner
Beginner

Joined: Thu Jul 22, 2004 4:32 am
Posts: 31
Said as christian ,you should keep session open if you want to access an uninitialized collection.


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.