[jboss-user] [JBoss Portal] - Re: Hibernate Open Session In View (in Portlet)
do-not-reply at jboss.com
Thu Apr 3 06:33:01 EDT 2008
The problem is, that you have an open session in the doView()-Method of the GenericPortlet. However, The strange thing is that the session is open as well in the jsp as my latest investigations have shown.
These are the last lines of the doView-Method:
| PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/test/test.jsp");
| prd.include(rRequest, rResponse);
The session is open before and after the call to prd.include(rRequest, rResponse);. It is open as well in the JSP (I have put the session into the httpsession and retrieved it in the jsp). I can even reattach objects to that session in the JSP and work with the lazy objects. If I dont reattach the objects the mentioned Lazy Initialization Exception (no session or session is closed) will be thrown.
The question is: why do I have to reattach the objects although the session has not been closed?
Keeping an closer eye on the "lazy" object I found out that the PersistentMap from Hibernate which is used instead of the "normal" collection has the session-attribute set to null. Is there anyone who can explain at which point this happened or how i can prevent this from happening?
Maybe this has something to do with the bound JTA-Transaction?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4141263#4141263
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4141263
More information about the jboss-user