public final class TxScope extends Object
This information matches the features of the Transactional annotation. You
can use it directly with TxRunnable or TxCallable via
Ebean.execute(TxScope, TxCallable) or
Ebean.execute(TxScope, TxRunnable).
This object is used internally with the enhancement of a method with Transactional annotation.
| Constructor and Description |
|---|
TxScope()
Create a REQUIRED transaction scope.
|
TxScope(TxType type)
Create with a given transaction scope type.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkBatchMode()
Check for batchSize being set without batch mode and use this to imply PersistBatch.ALL.
|
PersistBatch |
getBatch()
Return the batch mode.
|
PersistBatch |
getBatchOnCascade()
Return the batch on cascade mode.
|
int |
getBatchSize()
Return the batch size.
|
TxIsolation |
getIsolation()
Return the Isolation level this transaction should run with.
|
ArrayList<Class<? extends Throwable>> |
getNoRollbackFor()
Return the throwable's that should NOT cause a rollback.
|
ArrayList<Class<? extends Throwable>> |
getRollbackFor()
Return the throwable's that should cause a rollback.
|
String |
getServerName()
Return the serverName for this transaction.
|
TxType |
getType()
Return the transaction type.
|
boolean |
isBatchOnCascadeSet()
Return true if batch on cascade has been set.
|
boolean |
isBatchSet()
Return true if PersistBatch has been set.
|
boolean |
isBatchSizeSet()
Return true if batch size has been set.
|
boolean |
isReadonly()
Return if the transaction should be treated as read only.
|
boolean |
isSkipGeneratedKeys()
Return true if getGeneratedKeys should be skipped for this transaction.
|
static TxScope |
mandatory()
Helper method to create a TxScope with MANDATORY.
|
static TxScope |
never()
Helper method to create a TxScope with NEVER.
|
static TxScope |
notSupported()
Helper method to create a TxScope with NOT_SUPPORTED.
|
static TxScope |
required()
Helper method to create a TxScope with REQUIRES.
|
static TxScope |
requiresNew()
Helper method to create a TxScope with REQUIRES_NEW.
|
TxScope |
setBatch(PersistBatch batch)
Set the batch mode to use.
|
TxScope |
setBatchOnCascade(PersistBatch batchOnCascade)
Set the batch on cascade mode.
|
TxScope |
setBatchSize(int batchSize)
Set the batch size to use.
|
TxScope |
setIsolation(TxIsolation isolation)
Set the transaction isolation level this transaction should run with.
|
TxScope |
setNoRollbackFor(Class<?>[] noRollbacks)
Set multiple throwable's that will NOT cause a rollback.
|
TxScope |
setNoRollbackFor(Class<? extends Throwable> noRollback)
Add a Throwable to a list that will NOT cause a rollback.
|
TxScope |
setReadOnly(boolean readOnly)
Set if the transaction should be treated as read only.
|
TxScope |
setRollbackFor(Class<?>[] rollbackThrowables)
Set multiple throwable's that will cause a rollback.
|
TxScope |
setRollbackFor(Class<? extends Throwable> rollbackThrowable)
Set a Throwable that should explicitly cause a rollback.
|
TxScope |
setServerName(String serverName)
Set the serverName (DataSource name) for which this transaction will be.
|
TxScope |
setSkipGeneratedKeys()
Set if the transaction should skip reading generated keys for inserts.
|
TxScope |
setType(TxType type)
Set the transaction type.
|
static TxScope |
supports()
Helper method to create a TxScope with SUPPORTS.
|
String |
toString()
Describes this TxScope instance.
|
public TxScope()
public static TxScope requiresNew()
public static TxScope notSupported()
public boolean isBatchSet()
public boolean isBatchOnCascadeSet()
public boolean isBatchSizeSet()
public void checkBatchMode()
public PersistBatch getBatch()
public TxScope setBatch(PersistBatch batch)
public PersistBatch getBatchOnCascade()
public TxScope setBatchOnCascade(PersistBatch batchOnCascade)
public int getBatchSize()
public TxScope setBatchSize(int batchSize)
public TxScope setSkipGeneratedKeys()
public boolean isSkipGeneratedKeys()
public boolean isReadonly()
public TxScope setReadOnly(boolean readOnly)
public TxIsolation getIsolation()
public TxScope setIsolation(TxIsolation isolation)
public String getServerName()
public TxScope setServerName(String serverName)
public ArrayList<Class<? extends Throwable>> getRollbackFor()
public TxScope setRollbackFor(Class<? extends Throwable> rollbackThrowable)
public TxScope setRollbackFor(Class<?>[] rollbackThrowables)
public ArrayList<Class<? extends Throwable>> getNoRollbackFor()
public TxScope setNoRollbackFor(Class<? extends Throwable> noRollback)
public TxScope setNoRollbackFor(Class<?>[] noRollbacks)
Copyright © 2016. All rights reserved.