Interface TransactionManager
- All Known Implementing Classes:
DefaultTransactionManager
public interface TransactionManager
An optional utility service that simplifies wrapping multiple operations in
transactions. Users only rarely need to invoke it directly, as all standard
Cayenne operations are managing their own transactions internally.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescription<T> TStarts a new transaction (or joins an existing one) callingTransactionalOperation.perform(), and then committing or rolling back the transaction.<T> TperformInTransaction(TransactionalOperation<T> op, TransactionDescriptor descriptor) Performs operation in a transaction which parameters described by descriptor.<T> TperformInTransaction(TransactionalOperation<T> op, TransactionFactory transactionFactory) Performs an operation in a transaction created by the supplied factory, instead of the configured one.<T> TperformInTransaction(TransactionalOperation<T> op, TransactionListener callback) Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform(), and then committing or rolling back the transaction.<T> TperformInTransaction(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor) Performs operation in a transaction which parameters described by descriptor.
-
Method Details
-
performInTransaction
Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform(), and then committing or rolling back the transaction.- Type Parameters:
T- returned value type- Parameters:
op- an operation to perform within the transaction.- Returns:
- a value returned by the "op" operation.
-
performInTransaction
Starts a new transaction (or joins an existing one) callingTransactionalOperation.perform(), and then committing or rolling back the transaction. As transaction goes through stages, callback methods are invoked allowing the caller to customize transaction parameters.- Type Parameters:
T- returned value type- Parameters:
op- an operation to perform within the transaction.callback- a callback to notify as transaction progresses through stages.- Returns:
- a value returned by the "op" operation.
-
performInTransaction
Performs operation in a transaction which parameters described by descriptor.- Type Parameters:
T- result type- Parameters:
op- an operation to perform within the transaction.descriptor- transaction descriptor- Returns:
- a value returned by the "op" operation.
- Since:
- 4.1
-
performInTransaction
<T> T performInTransaction(TransactionalOperation<T> op, TransactionListener callback, TransactionDescriptor descriptor) Performs operation in a transaction which parameters described by descriptor. As transaction goes through stages, callback methods are invoked allowing the caller to customize transaction parameters.- Type Parameters:
T- returned value type- Parameters:
op- an operation to perform within the transaction.callback- a callback to notify as transaction progresses through stages.descriptor- transaction descriptor- Returns:
- a value returned by the "op" operation.
- Since:
- 4.1
-
performInTransaction
Performs an operation in a transaction created by the supplied factory, instead of the configured one. This lets callers run an operation in a special transaction, such as aReadOnlyTransaction. Behaves likeTransactionPropagation.NESTED- joining an existing transaction if one is bound, otherwise creating a new one from the given factory.- Type Parameters:
T- returned value type- Parameters:
op- an operation to perform within the transaction.transactionFactory- a factory for the transaction to run the operation in.- Returns:
- a value returned by the "op" operation.
- Since:
- 5.0
-