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: LazyInitializerException
PostPosted: Wed Jul 20, 2011 7:08 am 
Newbie

Joined: Wed Jul 20, 2011 6:56 am
Posts: 1
Hi

I'm new to hibernate, and I used it in my project but, now I have an exception:

org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:80)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:133)
at com.raj.shopping.domain.SecondryCategory$$EnhancerByCGLIB$$87dcf58d.getMainCategory(<generated>)


I have tow class named SecondryCategory and MainCategory, I have an instance of MainCategory in SecondryCategory and in my code I need to get it to use. I guess it should be related to fetching objects in 1 more deep but I don't know how to
fix it.

please someone help me.


Top
 Profile  
 
 Post subject: Re: LazyInitializerException
PostPosted: Wed Jul 20, 2011 7:31 am 
Newbie

Joined: Fri Jul 01, 2011 7:18 am
Posts: 2
Hi,
If you try to access the fetched objects after closing your session, this exception will throw.
Use lazy="true" or Hibernate.initialize(youobjname);

Regds,
RJ


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.