Package io.micronaut.transaction
Interface TransactionExecution
- All Known Subinterfaces:
AsyncTransactionStatus<T>
,InternalTransaction<T>
,ReactiveTransactionStatus<T>
,TransactionStatus<T>
- All Known Implementing Classes:
AbstractInternalTransaction
,AbstractReactorTransactionOperations.DefaultReactiveTransactionStatus
,DefaultTransactionStatus
public interface TransactionExecution
Common representation of the current state of a transaction.
Serves as base interface for
TransactionStatus
as well as
ReactiveTransactionStatus
.
Partially based on https://github.com/spring-projects/spring-framework/blob/main/spring-tx/src/main/java/org/springframework/transaction/TransactionExecution.java- Since:
- 5.2
- Author:
- Juergen Hoeller, graemerocher
-
Method Summary
Modifier and TypeMethodDescription@NonNull TransactionDefinition
The transaction definition.boolean
Return whether this transaction is completed, that is, whether it has already been committed or rolled back.boolean
Return whether the present transaction is new; otherwise participating in an existing transaction, or potentially not running in an actual transaction in the first place.boolean
Return whether the transaction has been marked as rollback-only (either by the application or by the transaction infrastructure).void
Set the transaction rollback-only.
-
Method Details
-
isNewTransaction
boolean isNewTransaction()Return whether the present transaction is new; otherwise participating in an existing transaction, or potentially not running in an actual transaction in the first place.- Returns:
- Whether the execution is a new transaction
-
setRollbackOnly
void setRollbackOnly()Set the transaction rollback-only. This instructs the transaction manager that the only possible outcome of the transaction may be a rollback, as alternative to throwing an exception which would in turn trigger a rollback. -
isRollbackOnly
boolean isRollbackOnly()Return whether the transaction has been marked as rollback-only (either by the application or by the transaction infrastructure).- Returns:
- Whether the execution has been marked to rollback
-
isCompleted
boolean isCompleted()Return whether this transaction is completed, that is, whether it has already been committed or rolled back.- Returns:
- Whether the execution has completed
-
getTransactionDefinition
The transaction definition.- Returns:
- the transaction definition
- Since:
- 4.0.0
-