HHH-12391 - with IronJacamar an EntityTransaction.rollback() with a non active Transaction that was marked for rollback only causes a failure

This commit is contained in:
Andrea Boriero 2018-03-16 11:54:56 +00:00
parent fdadd973ac
commit 593d93d28f
4 changed files with 19 additions and 14 deletions

View File

@ -245,10 +245,15 @@ public class JdbcResourceLocalTransactionCoordinatorImpl implements TransactionC
@Override
public void rollback() {
if ( rollbackOnly || getStatus() == TransactionStatus.ACTIVE ) {
try {
TransactionStatus status = jdbcResourceTransaction.getStatus();
if ( ( rollbackOnly && status != TransactionStatus.NOT_ACTIVE ) || status == TransactionStatus.ACTIVE ) {
jdbcResourceTransaction.rollback();
JdbcResourceLocalTransactionCoordinatorImpl.this.afterCompletionCallback( false );
}
}
finally {
rollbackOnly = false;
jdbcResourceTransaction.rollback();
JdbcResourceLocalTransactionCoordinatorImpl.this.afterCompletionCallback( false );
}
// no-op otherwise.

View File

@ -17,17 +17,17 @@ public interface JdbcResourceTransaction {
/**
* Begin the resource transaction
*/
public void begin();
void begin();
/**
* Commit the resource transaction
*/
public void commit();
void commit();
/**
* Rollback the resource transaction
*/
public void rollback();
void rollback();
public TransactionStatus getStatus();
TransactionStatus getStatus();
}

View File

@ -19,5 +19,5 @@ public interface JdbcResourceTransactionAccess {
*
* @return The resource-local transaction
*/
public JdbcResourceTransaction getResourceLocalTransaction();
JdbcResourceTransaction getResourceLocalTransaction();
}

View File

@ -21,21 +21,21 @@ public interface JtaTransactionAdapter {
/**
* Call begin on the underlying transaction object
*/
public void begin();
void begin();
/**
* Call commit on the underlying transaction object
*/
public void commit();
void commit();
/**
* Call rollback on the underlying transaction object
*/
public void rollback();
void rollback();
public TransactionStatus getStatus();
TransactionStatus getStatus();
public void markRollbackOnly();
void markRollbackOnly();
public void setTimeOut(int seconds);
void setTimeOut(int seconds);
}