Interface TransactionController
-
- All Known Implementing Classes:
CopperTransactionController
public interface TransactionController
COPPER supports custom Transaction Management by using a built-in or custom Transaction Controller. COPPER comes with a simple build in Transaction Mgmt (seeCopperTransactionController
and a transaction controller that uses Springs Transaction Managament (seeSpringTransactionController
in project copper-spring).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
run(DatabaseTransaction<T> txn)
Runs a database transaction, i.e.<T> T
run(Transaction<T> txn)
Runs a transaction, the provided DatabaseTransaction object is executed in the scope of a transaction.
-
-
-
Method Detail
-
run
<T> T run(DatabaseTransaction<T> txn) throws java.lang.Exception
Runs a database transaction, i.e. a database connection is aquired and the provided DatabaseTransaction object is executed in the scope of a transaction.- Type Parameters:
T
- return type which is passed back by the succeeded transaction. Might be null if transaction runs without giving a result.- Parameters:
txn
- a database transaction object which will be run by the transaction controller.- Returns:
- the result of the transaction if any.
- Throws:
java.lang.Exception
- if something goes wrong within the given transaction which is not caught by itself or if something goes wrong with the transaction management like getConnection throws an SQLException.
-
run
<T> T run(Transaction<T> txn) throws java.lang.Exception
Runs a transaction, the provided DatabaseTransaction object is executed in the scope of a transaction. A database, JMS, or any other connection may be aquired later on in this transaction, but to do so is in the scope of the Transaction object. The TransactionController is just defining the start and end of the transaction.- Type Parameters:
T
- return type which is passed back by the succeeded transaction. Might be null if transaction runs without giving a result.- Parameters:
txn
- a database transaction object which will be run by the transaction controller- Returns:
- the result of the transaction if any.
- Throws:
java.lang.Exception
- if something goes wrong within the given transaction which is not caught by itself or if something goes wrong with the transaction management like getConnection throws an SQLException.
-
-