xinxin wrote:
I am going to implement a web application using Hibernate, and I'll create a servlet for controlling. I am not sure if I need to use ThreadLocal to handle the session? I am a bit confused; anyone knows when we are supposing to use ThreadLocal?
Threadlocal variables are a convinient way to get the power of singleton model wo having it's drawbacks:
* you can access threaded variable easily
* no synchro needed (neither scalability issues) since you use it in the same thread
This roll for 2+ tiers applications