Patch from Charlie to always commit if auto-commit is off.

This commit is contained in:
Michael Bayne
2009-09-22 01:54:38 +00:00
parent 04dc2daa8b
commit 681f420b8f
@@ -563,8 +563,10 @@ public class PersistenceContext
stmt.close(); stmt.close();
} }
} }
// if auto-commit is off and this is a write operation, push it through // Always commit if auto-commit is off. If the read-only operation managed to
if (!isReadOnly && !conn.getAutoCommit()) { // acquire some locks, this will release them. Also, we've seen a MySQL bug where
// not committing after a select causes later selects to see stale results.
if (!conn.getAutoCommit()) {
conn.commit(); conn.commit();
} }
// note the time it took to invoke this operation // note the time it took to invoke this operation