mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
#791 - ENH: Add transaction.setRollbackOnly() ... (and Ebean.setRollbackOnly())
This commit is contained in:
1 parent
d82148248c
commit
b4a1d52067
6 files changed
+93
No files matched your search
@@ -66,6 +66,8 @@ public class JdbcTransaction implements SpiTransaction {
|
||||
*/
|
||||
protected boolean active;
|
||||
|
||||
protected boolean rollbackOnly;
|
||||
|
||||
/**
|
||||
* The underlying Connection.
|
||||
*/
|
||||
@@ -903,6 +905,10 @@ public class JdbcTransaction implements SpiTransaction {
|
||||
*/
|
||||
@Override
|
||||
public void commit() throws RollbackException {
|
||||
if (rollbackOnly) {
|
||||
rollback();
|
||||
return;
|
||||
}
|
||||
if (!isActive()) {
|
||||
throw new IllegalStateException(illegalStateMessage);
|
||||
}
|
||||
@@ -945,6 +951,14 @@ public class JdbcTransaction implements SpiTransaction {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the transaction as rollback only.
|
||||
*/
|
||||
@Override
|
||||
public void setRollbackOnly() {
|
||||
this.rollbackOnly = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback the transaction.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user