Hi All!
I have written a POJO, and a DAO for every POJO.
I access the DAO from a StateFul Session Bean(SFSB).
Code:
e.g.
======
Session mySession = SessionFactory.getSession();
DepartmentDAO deptDAO = new DepartmentDAO( mySession );
EmployeeDAO empDAO = new EmployeeDAO( mySession );
Transaction transaction = mySession.beginTransaction();
try
{
empDAO.saveEmployee( new Employee(...) );
deptDAO.save( new Department(...) );
transaction.commit()
}
catch( DAOException exc )
{
transaction.rollback();
}
======
Now, when I do the above from a method in a SFSB, do I need to worry about ThreadLocal session.
Also, what happens, when I define the session as an instance variable, instead of a method variable ?
TIA,
Kunal