Annotation Type Transactional
Any method marked with this annotation will be considered for transactionality.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe TxType element of the annotation indicates whether a bean method is to be executed within a transaction context where the values provide the following corresponding behavior. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanDeprecated.Users that intend auto commit can achieve it by simply not using @TransactionalA custom error message when throwing the custom exception.org.apache.ibatis.session.ExecutorTypeReturns the constant indicating the myBatis executor type.booleanFlag to indicate that myBatis has to force the transactioncommit().Returns the constant indicating the transaction isolation level.org.apache.ibatis.session.TransactionIsolationLevelDeprecated.useisolation()instead, setting this property has no effect.The exception re-thrown when an error occurs during the transaction.booleanIf true, the transaction will never committed but rather rolled back, useful for testing purposes.The TxType element of the Transactional annotation indicates whether a bean method is to be executed within a transaction context.
-
Element Details
-
executorType
org.apache.ibatis.session.ExecutorType executorTypeReturns the constant indicating the myBatis executor type.- Returns:
- the constant indicating the myBatis executor type.
- Default:
SIMPLE
-
isolation
Isolation isolationReturns the constant indicating the transaction isolation level.- Returns:
- the constant indicating the transaction isolation level.
- Default:
DEFAULT
-
isolationLevel
Deprecated.useisolation()instead, setting this property has no effect.Returns the constant indicating the transaction isolation level.- Returns:
- the constant indicating the transaction isolation level.
- Default:
NONE
-
force
boolean forceFlag to indicate that myBatis has to force the transactioncommit().- Returns:
- false by default, user defined otherwise.
- Default:
false
-
autoCommit
Deprecated.Users that intend auto commit can achieve it by simply not using @TransactionalFlag to indicate the auto commit policy.- Returns:
- false by default, user defined otherwise.
- Default:
false
-
rethrowExceptionsAs
-
exceptionMessage
String exceptionMessageA custom error message when throwing the custom exception.It supports java.util.Formatter place holders, intercepted method arguments will be used as message format arguments.
- Returns:
- a custom error message when throwing the custom exception.
- See Also:
- Default:
""
-
rollbackOnly
boolean rollbackOnlyIf true, the transaction will never committed but rather rolled back, useful for testing purposes.This parameter is false by default.
- Returns:
- if true, the transaction will never committed but rather rolled back, useful for testing purposes.
- Default:
false
-
value
Transactional.TxType valueThe TxType element of the Transactional annotation indicates whether a bean method is to be executed within a transaction context.- Returns:
- the tx type
- Default:
REQUIRED
-