Hi, I have some bean with application logic
Code:
public class MyClass{
...
public void myMethod(){
try{
session=HibUtil.currentSession();
...
}catch (HibernateException ex){
}finally{
HibUtil.closeSession();
}
}
}
where class HibUtil manages a thread local session.
When I start a web application, I create a MyClass instance and save it to application context. I have several struts actions, where I always take the instance from app. context and call its myMethod. I'd like to ask whether new threadlocal session is created every time i call action in struts or not..
The problem is that when I call another method from myMethod, I don't won't to close session in the inner method. So I can create new threadlocal variable which counts a depth of nesting and close session only if the depth is 0.
But I don't know whether sessions won't mix when some struts action is called many times at the same time..