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:
parent
fdadd973ac
commit
593d93d28f
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -19,5 +19,5 @@ public interface JdbcResourceTransactionAccess {
|
|||
*
|
||||
* @return The resource-local transaction
|
||||
*/
|
||||
public JdbcResourceTransaction getResourceLocalTransaction();
|
||||
JdbcResourceTransaction getResourceLocalTransaction();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue