Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:hibernate3
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: failed to lazily initialize a collection of role: src.model.Forums.discussList - no session or session was closed
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
src.control.DiscussForum.doGet(Unknown Source)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
root cause
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: src.model.Forums.discussList - no session or session was closed
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:191)
org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:183)
org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:48)
org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:134)
org.apache.jsp.pages.forum.discuss_jsp._jspService(discuss_jsp.java:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
src.control.DiscussForum.doGet(Unknown Source)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
Apache Tomcat/5.0.27
Name and version of the database you are using:MySQL v4.0
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
My project works fine when the lazy is set to false but gives trouble when lazy is set to true. I am using the appfuse architecture with spring and hibernate. My database is MYSQL v5.0 and am using Apache Tomcat Server.
Please help
regards
Chanchal