cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel McConaughy <>
Subject Re: Where to store a hibernate session in Flow?
Date Wed, 04 Aug 2004 02:34:08 GMT
Good to hear from you, Mark.  Actually, what I'd like to do is keep the 
session factory open during the course of either the session or 
application context.  Then I can just open and close sessions as needed 
-- hopefully providing a performance improvement.  If there really isn't 
any way to get notified when the session or application context get 
invalidated so I can close the factory, then they are pretty useless IMO.

As an alternative, I could write an HttpSessionListener implementation 
however since this is called by the container (configured in the web.xml 
file), I don't know how to access it from Flow.

This is one of those things that seems like it should be simple.  Any 
ideas?  Thanks in advance.

Mark Lundquist wrote:

> On Aug 3, 2004, at 6:20 PM, Joel McConaughy wrote:
>> I would like to open one hibernate session for each user session and 
>> close it when the session is invalidated or times out.  I can see how 
>> save the hibernate session in Flow using 
>> cocoon.session.setAttribute() and cocoon.session.getAttribute() 
>> however there doesn't seem to be a way to get notified when the 
>> session gets invalidated so I can close the hibernate session.   Is 
>> there a way to do this?
> Hi Joel,
> Just curious, why do you want the Hibernate session to have the same 
> lifetime as the user session?  Typically, in a web application context 
> a Hibernate session should be thought of as corresponding to a single 
> HTTP request/reply.
> See also this article: 
> Actually, they make mention of the "session-per-user-session 
> anti-pattern" at the end of that article...
> Cheers,
> ~ml
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message