Hi,
 
I am using cocoon 2.1.5 and hibernate. I have got a component wrapping the SessionFactory and as far as I can tell everything seems to work pretty well. The issue is that I am using a session-per-user-session anti-pattern as defined by the hibernate documentation http://www.hibernate.org/168.html. I would like to move to a session-per-request pattern. I figured it would be easy to keep a session per thread using a ThreadLocal. The only problem is that I don't know where I could close the session again.
Has anyone done this before? If not, where would be good points to create and close the hibernate session. Maybe in the flow using a threadlocal and close it whenever a page view is called? The problem with that is that the session would need to stay open until after the view call as there might be lazy objects that get displayed.
Any help appreciated,

Jakob Schwendner
------
Public Image
Creative Strategy & Production
for Print, Online & Broadcast Media

Reply via email to