I believe that is what I am using now (it seems to be quite popular) but I don't quite understand the reasoning behind the ThreadLocal approach (I've actually never used 'ThreadLocal')... can you shed some light on this? What the mapping between Hibernate Sessions and Users (or Threads) becomes?
Marco Mistroni wrote:
Hi, On hibernate website, there's an example that associates A session to a threadlocal. You can safely use that pattern (it's one Of hibernate patterns)... You could have a DAOFactory (plugin) which instantiates the SessionFactory, And each DAO will get its own session associated with its ThreadLocal..
Have a look at hibernate website for patterns on how to use Session
Regards, marco
-----Original Message-----
From: Riyad Kalla [mailto:[EMAIL PROTECTED] Sent: 08 June 2004 00:14
To: Struts Users Mailing List
Subject: OT: Hibernate Session to User Session
I was reading in the Hibernate forums that when you have a WebApp > DAO
Hibernate > DB design, and you open/close each Hibernate session at
every single DAO method call (what I do now) its actually quite expensive, and is suggested that you attempt to maintain a Hibernate Session in conjunction with a user Session to increase performance.
I had a question for anyone that has done this (without using SpringFramework). My gut-reaction to this was to add a HttpSessionListener to my webapp that created and stored a Hibernate session in the user's session, and then close it when the Session expired... will this not work? Anyone else have a good solution for this?
TIA, Riyad
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]