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?
|