Hibernate version: 1.2.0 (.NET 1.1)
Code between sessionFactory.openSession() and session.close():
That's the question: this:
Code:
using (ISession sess = factory.OpenSession())
using (ITransaction tx = sess.BeginTransaction()) {
// do some work...
tx.Commit();
}
- or this:
Code:
using (ISession sess = factory.OpenSession()) {
ITransaction tx = sess.BeginTransaction();
try {
// do some work...
tx.Commit();
}
catch ( Exception ex ) {
tx.Rollback();
throw;
}
}
Are these (as the docs imply, but do not state) essentially equivalent? That is: does ITransaction.Dispose() provide the required rollback? Or again: as AdoTransaction.Dispose() (the default impl) falls back on IDbTransaction.Dispose(), does it cause a rollback?