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
0a42a5273d
commit
9cc9a6882a
|
@ -288,10 +288,15 @@ public class JdbcResourceLocalTransactionCoordinatorImpl implements TransactionC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rollback() {
|
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;
|
rollbackOnly = false;
|
||||||
jdbcResourceTransaction.rollback();
|
|
||||||
JdbcResourceLocalTransactionCoordinatorImpl.this.afterCompletionCallback( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no-op otherwise.
|
// no-op otherwise.
|
||||||
|
|
|
@ -17,17 +17,17 @@ public interface JdbcResourceTransaction {
|
||||||
/**
|
/**
|
||||||
* Begin the resource transaction
|
* Begin the resource transaction
|
||||||
*/
|
*/
|
||||||
public void begin();
|
void begin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commit the resource transaction
|
* Commit the resource transaction
|
||||||
*/
|
*/
|
||||||
public void commit();
|
void commit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rollback the resource transaction
|
* 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
|
* @return The resource-local transaction
|
||||||
*/
|
*/
|
||||||
public JdbcResourceTransaction getResourceLocalTransaction();
|
JdbcResourceTransaction getResourceLocalTransaction();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,21 @@ public interface JtaTransactionAdapter {
|
||||||
/**
|
/**
|
||||||
* Call begin on the underlying transaction object
|
* Call begin on the underlying transaction object
|
||||||
*/
|
*/
|
||||||
public void begin();
|
void begin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call commit on the underlying transaction object
|
* Call commit on the underlying transaction object
|
||||||
*/
|
*/
|
||||||
public void commit();
|
void commit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call rollback on the underlying transaction object
|
* 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