java.lang.Object
io.ebean.TxScope
Holds the definition of how a transactional method should run.
This information matches the features of the Transactional annotation. You
can use it directly with Runnable or Callable via
DB.execute(TxScope, Runnable)
or
DB.executeCall(TxScope, Callable)
.
This object is used internally with the enhancement of a method with Transactional annotation.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Check for batchSize being set without batch mode and use this to imply PersistBatch.ALL.Return the AutoPersistUpdates mode as a nullable Boolean.io.ebean.annotation.PersistBatch
getBatch()
Return the batch mode.io.ebean.annotation.PersistBatch
Return the batch on cascade mode.int
Return the batch size.io.ebean.annotation.TxIsolation
Return the Isolation level this transaction should run with.int
Return the isolation level.getLabel()
Return the label for the transaction.Return the throwable's that should NOT cause a rollback.int
Return the transaction profile id.Return the profile location.Return the throwable's that should cause a rollback.Return the serverName for this transaction.io.ebean.annotation.TxType
getType()
Return the transaction type.boolean
boolean
boolean
Return true if batch on cascade has been set.boolean
Return true if PersistBatch has been set.boolean
Return true if batch size has been set.boolean
Return false if the JDBC batch buffer should not be flushed automatically when a query is executed.boolean
Return if the transaction should be treated as read only.boolean
Return true if the L2 cache should be skipped for this transaction.boolean
Return true if getGeneratedKeys should be skipped for this transaction.static TxScope
Helper method to create a TxScope with MANDATORY.static TxScope
never()
Helper method to create a TxScope with NEVER.static TxScope
Helper method to create a TxScope with NOT_SUPPORTED.static TxScope
required()
Helper method to create a TxScope with REQUIRES.static TxScope
Helper method to create a TxScope with REQUIRES_NEW.setAutoPersistUpdates
(io.ebean.annotation.TxOption autoPersistUpdates) Set the autoPersistUpdates mode.setBatch
(io.ebean.annotation.PersistBatch batch) Set the batch mode to use.setBatchOnCascade
(io.ebean.annotation.PersistBatch batchOnCascade) Set the batch on cascade mode.setBatchSize
(int batchSize) Set the batch size to use.setFlushOnQuery
(boolean flushOnQuery) Set flushOnQuery to be false to stop automatically flushing the JDBC batch buffer when a query is executed.setIsolation
(io.ebean.annotation.TxIsolation isolation) Set the transaction isolation level this transaction should run with.Set a label for the transaction.setNoRollbackFor
(Class<?>[] noRollbacks) Set multiple throwable's that will NOT cause a rollback.setNoRollbackFor
(Class<? extends Throwable> noRollback) Add a Throwable to a list that will NOT cause a rollback.setProfileId
(int profileId) Set the transaction profile id.setProfileLocation
(ProfileLocation profileLocation) Set the profile location.setReadOnly
(boolean readOnly) Set if the transaction should be treated as read only.setRollbackFor
(Class<?>[] rollbackThrowables) Set multiple throwable's that will cause a rollback.setRollbackFor
(Class<? extends Throwable> rollbackThrowable) Set a Throwable that should explicitly cause a rollback.setServerName
(String serverName) Set the serverName (DataSource name) for which this transaction will be.setSkipCache
(boolean skipCache) Set to true if the transaction should skip L2 cache access.Set if the transaction should skip reading generated keys for inserts.setType
(io.ebean.annotation.TxType type) Set the transaction type.static TxScope
supports()
Helper method to create a TxScope with SUPPORTS.toString()
Describes this TxScope instance.
-
Constructor Details
-
TxScope
public TxScope()Create a REQUIRED transaction scope. -
TxScope
public TxScope(io.ebean.annotation.TxType type) Create with a given transaction scope type.
-
-
Method Details
-
required
Helper method to create a TxScope with REQUIRES. -
requiresNew
Helper method to create a TxScope with REQUIRES_NEW. -
mandatory
Helper method to create a TxScope with MANDATORY. -
supports
Helper method to create a TxScope with SUPPORTS. -
notSupported
Helper method to create a TxScope with NOT_SUPPORTED. -
never
Helper method to create a TxScope with NEVER. -
toString
Describes this TxScope instance. -
getAutoPersistUpdates
Return the AutoPersistUpdates mode as a nullable Boolean. -
isBatchSet
public boolean isBatchSet()Return true if PersistBatch has been set. -
isBatchOnCascadeSet
public boolean isBatchOnCascadeSet()Return true if batch on cascade has been set. -
isBatchSizeSet
public boolean isBatchSizeSet()Return true if batch size has been set. -
checkBatchMode
public void checkBatchMode()Check for batchSize being set without batch mode and use this to imply PersistBatch.ALL. -
getType
public io.ebean.annotation.TxType getType()Return the transaction type. -
setType
Set the transaction type. -
setAutoPersistUpdates
Set the autoPersistUpdates mode. -
getProfileId
public int getProfileId()Return the transaction profile id. -
setProfileId
Set the transaction profile id. -
getProfileLocation
Return the profile location. -
setProfileLocation
Set the profile location. -
isSkipCache
public boolean isSkipCache()Return true if the L2 cache should be skipped for this transaction. -
setSkipCache
Set to true if the transaction should skip L2 cache access. -
getLabel
Return the label for the transaction. -
setLabel
Set a label for the transaction. -
getBatch
public io.ebean.annotation.PersistBatch getBatch()Return the batch mode. -
setBatch
Set the batch mode to use. -
getBatchOnCascade
public io.ebean.annotation.PersistBatch getBatchOnCascade()Return the batch on cascade mode. -
setBatchOnCascade
Set the batch on cascade mode. -
getBatchSize
public int getBatchSize()Return the batch size. 0 means use the default value. -
setBatchSize
Set the batch size to use. -
setSkipGeneratedKeys
Set if the transaction should skip reading generated keys for inserts. -
isSkipGeneratedKeys
public boolean isSkipGeneratedKeys()Return true if getGeneratedKeys should be skipped for this transaction. -
isReadonly
public boolean isReadonly()Return if the transaction should be treated as read only. -
setReadOnly
Set if the transaction should be treated as read only. -
isFlushOnQuery
public boolean isFlushOnQuery()Return false if the JDBC batch buffer should not be flushed automatically when a query is executed. -
setFlushOnQuery
Set flushOnQuery to be false to stop automatically flushing the JDBC batch buffer when a query is executed. -
getIsolationLevel
public int getIsolationLevel()Return the isolation level. -
getIsolation
public io.ebean.annotation.TxIsolation getIsolation()Return the Isolation level this transaction should run with. -
setIsolation
Set the transaction isolation level this transaction should run with. -
getServerName
Return the serverName for this transaction. If this is null then the default server (default DataSource) will be used. -
setServerName
Set the serverName (DataSource name) for which this transaction will be. If the serverName is not specified (left null) then the default server will be used. -
getRollbackFor
Return the throwable's that should cause a rollback. -
setRollbackFor
Set a Throwable that should explicitly cause a rollback. -
setRollbackFor
Set multiple throwable's that will cause a rollback. -
getNoRollbackFor
Return the throwable's that should NOT cause a rollback. -
setNoRollbackFor
Add a Throwable to a list that will NOT cause a rollback. You are able to call this method multiple times with different throwable's and they will added to a list. -
setNoRollbackFor
Set multiple throwable's that will NOT cause a rollback. -
isBatchMode
public boolean isBatchMode() -
isBatchOnCascade
public boolean isBatchOnCascade()
-