Riyad Kalla wrote:

> 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?

The preferred mapping is still one Hibernate Session per HTTP Request.
You would also still need a Filter that instantiates the Session when
the request comes in and closes it when it is finished. But instead of
putting it into the request as an attribute, you can put it into a
ThreadLocal. That way, all methods that need the Session can simply
use the ThreadLocal to get it and you don't have to pass around
request attributes.

Carl-Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to