-->
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: Lazy Initialization Error - Owning Session was Closed
PostPosted: Fri Jun 01, 2007 12:22 pm 
Newbie

Joined: Sat Mar 31, 2007 12:19 pm
Posts: 2
Location: Yellagiri Hills
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)
com.dhd.dao.Country$$EnhancerByCGLIB$$76477ca0.getCountryName(<generated>)
com.dhd.struts.action.ParishListAction.viewParish(ParishListAction.java:123)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Dear All,

I have the following error. It would be very helpful If any of you give a solution.

Thank U

_________________
With Regards,

Veera


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 12:34 pm 
Beginner
Beginner

Joined: Thu Apr 12, 2007 10:43 am
Posts: 21
Location: Brazil
Hi veera,

Have a look at the link below:
http://www.hibernate.org/43.html

Cheers,
Roger


Top
 Profile  
 
 Post subject: Add Lazy="false"
PostPosted: Sat Jun 02, 2007 11:25 am 
Newbie

Joined: Sat Mar 31, 2007 12:19 pm
Posts: 2
Location: Yellagiri Hills
Dear all,

I myself had found the simple solution for this problem.

It is enough to add lazy="false" in Hibernate mapping file when the relations are specified like (one to one or many to one)

<many-to-one table="" field="" lazy="false" />

_________________
With Regards,

Veera


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 03, 2007 10:55 am 
Beginner
Beginner

Joined: Wed Oct 05, 2005 12:29 pm
Posts: 22
Hi Veera,

You should be careful about the performance implications of setting lazy="false". What it means is that everytime you retrieve a record, all it childerens will be retrieved at the same time - whether you need them or not. Performance could deterioriate exponentially if you are not careful!

Eager featching (i.e. lazy="false") should not be set in general.
For further readings: http://www.javalobby.org/java/forums/t20533.html.

Regards,
Yee


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.