calls to EntityTransaction.rollback() should be ignored if the LogicalConnection.physicalConnection is null or the LogicalConnection.physicalConnection.getAutoCommit() returns true

Description

I'm seeing the following error be thrown when the EntityTransaction is marked to rollback only and the LogicalConnection.physicalConnection is null. As per our discussion, we should ignore the EntityTransaction.rollback() if the LogicalConnection.physicalConnection.getAutoCommit() returns true. Seems to me that we should also ignore the rollback() call if LogicalConnection.physicalConnection is null, as it makes no sense to me, that we would get a new DB connection just to see if it's autocommit flag defaults to true.

org.hibernate.TransactionException: Unable to rollback against JDBC Connection
[javatest.batch] at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.rollback(AbstractLogicalConnectionImplementor.java:122)
[javatest.batch] at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.rollback(JdbcResourceLocalTransactionCoordinatorImpl.java:286)
[javatest.batch] at org.hibernate.engine.transaction.internal.TransactionImpl.rollback(TransactionImpl.java:125)

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Scott Marlow

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.3.0.CR1

Priority

Major