-->
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: "could not initialize proxy - the owning Session was cl
PostPosted: Wed Dec 20, 2006 8:07 pm 
Newbie

Joined: Wed Dec 20, 2006 7:49 pm
Posts: 1
Hi,

I get the following error when I set lazy="true":
"could not initialize proxy - the owning Session was closed"

When I change lazy="false", then it runs successfully.

Why?

Below is the error dump:

org.apache.jasper.JasperException: Exception in JSP: /order_dbaction.jsp:118

115: {
116: // only status field is editable on order edit
117: com.insequence.gv.NewOrder newOrder = dao.getNewOrder(new Long(id));
118: newOrder.setStatus(Integer.parseInt(status));
119:
120: // ask dao to persist the edits
121: if (!(dao.addNewOrder(newOrder)))


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:56)
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:133)
com.insequence.gv.NewOrder$$EnhancerByCGLIB$$e061f894_19.setStatus(<generated>)
org.apache.jsp.order_005fdbaction_jsp._jspService(order_005fdbaction_jsp.java:167)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

_________________
John J. Mitchell


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 4:46 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
This is a classical behaviour.

As said, because the session was closed. Just initialize the proxies before closing the session. You should read about proxies and what is the lazy-loading.

http://www.hibernate.org/hib_docs/v3/re ... ching-lazy

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


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.