Hibernate version: 3.0.4
Database: MySQL 4.1 (Innodb)
So, I am using the "non-managed idiom":
Code:
Session sess = factory.openSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
// do some work
...
tx.commit();
}
catch (RuntimeException e) {
if (tx != null) tx.rollback();
logError();
}
finally {
sess.close();
}
with the exception that I am using the Session-per-Thread pattern. Also, the above code is invoked from an MBean on JBoss 3.2.5.
I also have the StatisticsService MBean running (great work on this bean, BTW!). I notice the following:
Sometimes, there are an extra one or two Sessions that do not get closed (i.e., SessionOpenCount > SessionCloseCount), even though session.close() gets called everytime. I notice that this also tends to happen more often with a roll-back condition than normal. Anyone noticed this before?
--Thanks,
Liem