Hibernate version: 2.1
Hi All,
What is the behaviour of a transaction when the session that it was obtained from is closed via a call to Session.close() ?
Does this call cascade any other objects that were created by it as a call to Connection.close() does in JDBC with Statments etc?
If it does do a cascade clean up of objects created from it, what is the cleanup process for a transaction that has not been commited yet? Is a rollback called, a commit, or is the transaction just left hanging - tying up a connection and locking any database resources in use by it?
A common scenario might be when an exception is thrown mid transaction and close() is called from a finally section eg
Transaction tx = null;
try {
tx = session.beginTransaction();
// perform some code that causes an exception
} catch (HibernateException e) {
// handle exception
} finally {
session.close();
}
Cheers,
Ben
|