public final class TxScope extends Object
This information matches the features of the Transactional annotation. You
can use it directly with Runnable or Callable via
Ebean.execute(TxScope, Runnable)
or
Ebean.executeCall(TxScope, Callable)
.
This object is used internally with the enhancement of a method with Transactional annotation.
Constructor and Description |
---|
TxScope()
Create a REQUIRED transaction scope.
|
TxScope(io.ebean.annotation.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.
|
io.ebean.annotation.PersistBatch |
getBatch()
Return the batch mode.
|
io.ebean.annotation.PersistBatch |
getBatchOnCascade()
Return the batch on cascade mode.
|
int |
getBatchSize()
Return the batch size.
|
io.ebean.annotation.TxIsolation |
getIsolation()
Return the Isolation level this transaction should run with.
|
int |
getIsolationLevel()
Return the isolation level.
|
String |
getLabel()
Return the label for the transaction.
|
ArrayList<Class<? extends Throwable>> |
getNoRollbackFor()
Return the throwable's that should NOT cause a rollback.
|
int |
getProfileId()
Return the transaction profile id.
|
ProfileLocation |
getProfileLocation()
Return the profile location.
|
ArrayList<Class<? extends Throwable>> |
getRollbackFor()
Return the throwable's that should cause a rollback.
|
String |
getServerName()
Return the serverName for this transaction.
|
io.ebean.annotation.TxType |
getType()
Return the transaction type.
|
boolean |
isBatchMode() |
boolean |
isBatchOnCascade() |
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 |
isFlushOnQuery()
Return false if the JDBC batch buffer should not be flushed automatically when a query is executed.
|
boolean |
isReadonly()
Return if the transaction should be treated as read only.
|
boolean |
isSkipCache()
Return true if the L2 cache should be skipped for this transaction.
|
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(io.ebean.annotation.PersistBatch batch)
Set the batch mode to use.
|
TxScope |
setBatchOnCascade(io.ebean.annotation.PersistBatch batchOnCascade)
Set the batch on cascade mode.
|
TxScope |
setBatchSize(int batchSize)
Set the batch size to use.
|
TxScope |
setFlushOnQuery(boolean flushOnQuery)
Set flushOnQuery to be false to stop automatically flushing the JDBC batch buffer when a query is executed.
|
TxScope |
setIsolation(io.ebean.annotation.TxIsolation isolation)
Set the transaction isolation level this transaction should run with.
|
TxScope |
setLabel(String label)
Set a label for the transaction.
|
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 |
setProfileId(int profileId)
Set the transaction profile id.
|
TxScope |
setProfileLocation(ProfileLocation profileLocation)
Set the profile location.
|
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 |
setSkipCache(boolean skipCache)
Set to true if the transaction should skip L2 cache access.
|
TxScope |
setSkipGeneratedKeys()
Set if the transaction should skip reading generated keys for inserts.
|
TxScope |
setType(io.ebean.annotation.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 TxScope(io.ebean.annotation.TxType type)
public static TxScope requiresNew()
public static TxScope notSupported()
public boolean isBatchSet()
public boolean isBatchOnCascadeSet()
public boolean isBatchSizeSet()
public void checkBatchMode()
public io.ebean.annotation.TxType getType()
public int getProfileId()
public TxScope setProfileId(int profileId)
public ProfileLocation getProfileLocation()
public TxScope setProfileLocation(ProfileLocation profileLocation)
public boolean isSkipCache()
public TxScope setSkipCache(boolean skipCache)
public io.ebean.annotation.PersistBatch getBatch()
public io.ebean.annotation.PersistBatch getBatchOnCascade()
public TxScope setBatchOnCascade(io.ebean.annotation.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 boolean isFlushOnQuery()
public TxScope setFlushOnQuery(boolean flushOnQuery)
public int getIsolationLevel()
public io.ebean.annotation.TxIsolation getIsolation()
public TxScope setIsolation(io.ebean.annotation.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)
public boolean isBatchMode()
public boolean isBatchOnCascade()
Copyright © 2019. All rights reserved.