| Summary: | Setting connection auto commit incorrectly | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | steve |
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.foundation-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | minor | ||
| Priority: | P2 | CC: | steve, tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Setting target and priority. See the following page for details of what these fields mean: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: 1.1.2 Starting with a db connection with auto commit to false gets turned back on to true in DatabaseAccessor.basicCommitTransaction method. Our platform supports auto commit but in many cases we turn the auto commit to false on some connections since the code requires multiple sql statements to be in the same transaction. We noticed that when we have a db connection auto commit set to false and we do a commit, the connection's auto commit gets set back to true thus changing the state of the original connection. /** * Commit a transaction on the database. This means toggling the auto-commit option. */ public void basicCommitTransaction(AbstractSession session) throws DatabaseException { try { if (getPlatform().supportsAutoCommit()) { getConnection().commit(); getConnection().setAutoCommit(true); } else { getPlatform().commitTransaction(this); } } catch (SQLException exception) { DatabaseException commException = processExceptionForCommError(session, exception, null); if (commException != null) throw commException; throw DatabaseException.sqlException(exception, this, session, false); } } Couldn't the code save the original state and set it back to what it was in the first place? Reproducible: Always