Top Description Methods
org.jooq

public Interface TransactionProvider

Known Direct Implementers
org.jooq.impl.NoTransactionProvider, org.jooq.impl.ThreadLocalTransactionProvider, org.jooq.impl.DefaultTransactionProvider
Imports
java.sql.Savepoint, org.jooq.exception.DataAccessException, org.jooq.impl.DefaultTransactionProvider

The TransactionProvider SPI can be used to implement custom transaction behaviour that is applied when calling DSLContext#transactionResult(TransactionalCallable) or DSLContext#transaction(TransactionalRunnable).

A new Configuration copy is created from the calling DSLContext for the scope of a single transactions. Implementors may freely add custom data to Configuration#data(), in order to share information between begin(TransactionContext) and commit(TransactionContext) or rollback(TransactionContext), as well as to share information with nested transactions.

Implementors may freely choose whether they support nested transactions. An example implementation supporting nested transactions is DefaultTransactionProvider, which implements such transactions using JDBC Savepoints.

Author
Lukas Eder

Method Summary

Modifier and TypeMethod and Description
public void
begin(TransactionContext
the configuration scoped to this transaction and its nested transactions.
ctx
)

Begin a new transaction.

public void
commit(TransactionContext
the configuration scoped to this transaction and its nested transactions.
ctx
)

Commit a transaction.

public void
rollback(TransactionContext
the configuration scoped to this transaction and its nested transactions.
ctx
)

Rollback a transaction.

Method Detail

beginback to summary
public void begin(TransactionContext ctx) throws DataAccessException

Begin a new transaction.

This method begins a new transaction with a Configuration scoped for this transaction. The resulting Transaction object may be used by implementors to identify the transaction when commit(TransactionContext) or rollback(TransactionContext) is called.

Parameters
ctx:TransactionContext

the configuration scoped to this transaction and its nested transactions.

Exceptions
DataAccessException:
Any exception issued by the underlying database.
commitback to summary
public void commit(TransactionContext ctx) throws DataAccessException

Commit a transaction.

Parameters
ctx:TransactionContext

the configuration scoped to this transaction and its nested transactions.

Exceptions
DataAccessException:
Any exception issued by the underlying database.
rollbackback to summary
public void rollback(TransactionContext ctx) throws DataAccessException

Rollback a transaction.

Parameters
ctx:TransactionContext

the configuration scoped to this transaction and its nested transactions.

Exceptions
DataAccessException:
Any exception issued by the underlying database.