-->
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: LazyInitializationException when lazy="false"
PostPosted: Mon May 02, 2005 3:28 pm 
Beginner
Beginner

Joined: Wed Apr 20, 2005 9:30 am
Posts: 39
Hibernate version:
3.0.1
Mapping documents:
<class name="com.declivis.kc.Organization" table="organizations" schema="dbo" catalog="kc2" lazy="false">
[...]
Code between sessionFactory.openSession() and session.close():
List orgs = ds.createQuery("from Organization as org order by org.id").setCacheable(true).list();
ds.flush();
context.put("Organizations", orgs);
Full stack trace of any exception that occurs:
javax.servlet.ServletException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getName' in class com.declivis.kc.OrganizationType$$EnhancerByCGLIB$$f02bfcd0 threw exception class org.hibernate.LazyInitializationException : could not initialize proxy - the owning Session was closed at com.hyperworx.servlet.UniversalServlet.mergeTemplate(UniversalServlet.java:152) at com.declivis.kc.servlets.AdminServlet.doPost(Unknown Source) at com.declivis.kc.servlets.AdminServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:113) at javax.servlet.http.HttpServlet.service(HttpServlet.java:90) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:176) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208) at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:396) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:341) at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490) at com.caucho.util.ThreadPool.run(ThreadPool.java:423) at java.lang.Thread.run(Thread.java:595)
Name and version of the database you are using:
MS SQL Server 2000 sp3
Debug level Hibernate log excerpt:
May 02 15:23:51 org.hibernate.LazyInitializationException[ERROR]: could not initialize proxy - the owning Session was closed
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:134)
at com.declivis.kc.OrganizationType$$EnhancerByCGLIB$$f02bfcd0.getName(<generated>)

I frequently create collections of things [mostly lists] and stick them into a VelocityContext for rendering into a web page. Lately, I've been getting a number of these exceptions, even when the class declaration in the hbm.xml file is lazy=true

Any ideas?


Top
 Profile  
 
 Post subject: Whoops
PostPosted: Mon May 02, 2005 3:31 pm 
Beginner
Beginner

Joined: Wed Apr 20, 2005 9:30 am
Posts: 39
I should have said, "when lazy=false"

TIA


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.