TransactionScope
public interface TransactionScope<T extends Object> extends PooledConnection
A PooledConnection with an active transaction capable of performing nested transactions.
| See also | |
|---|---|
Transactor |
Summary
Public methods |
|
|---|---|
abstract @NonNull Void |
Rollback the transaction, completing it and returning the |
abstract @NonNull R |
<R extends Object> withNestedTransaction(Begins a nested transaction and runs the |
Inherited methods |
||
|---|---|---|
|
Public methods
rollback
abstract @NonNull Void rollback(@NonNull T result)
Rollback the transaction, completing it and returning the result.
| See also | |
|---|---|
withTransaction |
|
withNestedTransaction |
withNestedTransaction
abstract @NonNull R <R extends Object> withNestedTransaction(
@NonNull SuspendFunction1<@NonNull TransactionScope<@NonNull R>, @NonNull R> block
)
Begins a nested transaction and runs the block within the transaction. If block fails to complete normally i.e., an exception is thrown, or rollback is invoked then the transaction will be rollback, otherwise it is committed.
Note that a nested transaction is still governed by its parent transaction and it too must complete successfully for all its children transactions to be committed.
See also Savepoint
| Parameters | |
|---|---|
@NonNull SuspendFunction1<@NonNull TransactionScope<@NonNull R>, @NonNull R> block |
The code that will execute within the transaction. |