#810 - ENH: Add transaction.isRollbackOnly()

This commit is contained in:
Robin Bygrave
2016-08-05 12:14:58 +12:00
parent fdb839f90e
commit 6c182ecaa5
4 changed files with 23 additions and 0 deletions
@@ -118,6 +118,11 @@ public interface Transaction extends Closeable {
*/
void setRollbackOnly();
/**
* Return true if the transaction is marked as rollback only.
*/
boolean isRollbackOnly();
/**
* If the transaction is active then perform rollback. Otherwise do nothing.
*/
@@ -63,6 +63,11 @@ public class ScopedTransaction implements SpiTransaction {
scopeTrans.setRollbackOnly();
}
@Override
public boolean isRollbackOnly() {
return transaction.isRollbackOnly();
}
@Override
public void end() throws PersistenceException {
try {
@@ -965,6 +965,14 @@ public class JdbcTransaction implements SpiTransaction {
}
}
/**
* Return true if the transaction is marked as rollback only.
*/
@Override
public boolean isRollbackOnly() {
return rollbackOnly;
}
/**
* Mark the transaction as rollback only.
*/