-->
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.  [ 4 posts ] 
Author Message
 Post subject: LazyInitializationException
PostPosted: Sun Aug 14, 2005 4:15 am 
Newbie

Joined: Fri Dec 05, 2003 8:45 am
Posts: 12
I get this message:
Code:
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
   org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
   org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
   org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
   net.streambuffer.kelurahan.model.Perumahan$$EnhancerByCGLIB$$ab657000.addPenduduk(<generated>)


What do I need to check in order to get apps right back and working?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 7:25 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Follow the steps in "before posting":

http://www.hibernate.org/ForumMailingli ... AskForHelp


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 10:31 am 
Newbie

Joined: Fri Apr 08, 2005 6:28 pm
Posts: 17
Location: US
You can access lazy collection only when the object is persistent, i.e. associated with the session.

If you are using Hibernate Session directly, please ensure that you access collection before the session is closed. Then you can successfully access it after closing the session.

If you have a detached object , you need to reassociate it with a session using update() (or merge() or lock(), etc.)

If you use Spring or some other framework that hides Hibernate session, ensure that collection is accessed before transaction is closed.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 14, 2005 10:35 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:03 pm
Posts: 40
Dmitri Rasnitsyn wrote:

If you use Spring or some other framework that hides Hibernate session, ensure that collection is accessed before transaction is closed.


...or ensure, that the code accessing the collection is in transaction at all (since new session is opened and immediately cloased for each operation outside of transaction)


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