Annotation Interface Transactional
@Target({ANNOTATION_TYPE,METHOD,TYPE})
@Retention(RUNTIME)
@Around
@Type(TransactionalInterceptor.class)
public @interface Transactional
Micronaut alternative
jakarta.transaction.Transactional
annotation.
Internally jakarta.transaction.Transactional
it's `Javax` alternative is remapped to this annotation.- Since:
- 1.0
- Author:
- graemerocher
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe transaction isolation level.The optional name of the transaction.Defines the exceptions that will not result in a rollback.The transaction propagation type.boolean
true
if the transaction is read-only.Defines the exceptions that will not result in a rollback.int
The timeout for this transaction.A qualifier value for the specified transaction.Alias fortransactionManager()
.
-
Element Details
-
value
Alias fortransactionManager()
.- Returns:
- The transaction manager
- See Also:
- Default:
- ""
-
transactionManager
A qualifier value for the specified transaction.May be used to determine the target transaction manager, matching the qualifier value (or the bean name) of a specific
TransactionOperations
bean definition.- Returns:
- The transaction manager
- Since:
- 4.2
- See Also:
- Default:
- ""
-
propagation
TransactionDefinition.Propagation propagationThe transaction propagation type.Defaults to
TransactionDefinition.Propagation.REQUIRED
.- Returns:
- The propagation
- Default:
- REQUIRED
-
isolation
TransactionDefinition.Isolation isolationThe transaction isolation level.Defaults to
TransactionDefinition.Isolation.DEFAULT
.- Returns:
- The isolation level
- Default:
- DEFAULT
-
timeout
int timeoutThe timeout for this transaction.Defaults to the default timeout of the underlying transaction system.
- Returns:
- The timeout
- Default:
- -1
-
readOnly
boolean readOnlytrue
if the transaction is read-only.Defaults to
false
.This just serves as a hint for the actual transaction subsystem; it will not necessarily cause failure of write access attempts. A transaction manager which cannot interpret the read-only hint will not throw an exception when asked for a read-only transaction but rather silently ignore the hint.
- Returns:
- Whether is read-only transaction
- Default:
- false
-
rollbackFor
Defines the exceptions that will not result in a rollback.- Returns:
- The exception types that will not result in a rollback.
- Since:
- 3.5.0
- Default:
- {}
-
noRollbackFor
Defines the exceptions that will not result in a rollback.- Returns:
- The exception types that will not result in a rollback.
- Since:
- 3.5.0
- Default:
- {}
-
name
String nameThe optional name of the transaction.- Returns:
- The transaction name
- Since:
- 4.0.0
- Default:
- ""
-