Hibernate disables autocommit if you use the JDBCTransactionFactory, which is the default if you don't specify anything else.
Before starting a transaction:
toggleAutoCommit = session.connection().getAutoCommit();
if (toggleAutoCommit) session.connection().setAutoCommit(false);
After transaction:
if (toggleAutoCommit) session.connection().setAutoCommit(true);
So, either your JDBC Connection doesn't return the proper value on "getAutoCommit()", which can be a bug in the JDBC driver or something else in your setup is broken. I always turn off any autocommit in the global database configuration.
Can you show us the full stack trace and verify that your JDBC driver returns the correct value on "getAutoCommit()"?
_________________ JAVA PERSISTENCE WITH HIBERNATE http://jpwh.org Get the book, training, and consulting for your Hibernate team.
|