OctaviusJdbcTransactionManager

open class OctaviusJdbcTransactionManager(val dataSource: DataSource) : AbstractPlatformTransactionManager, ResourceTransactionManager

A transaction manager for a DataSource that runs each transaction through an OctaviusSession, so a failure of the database or the connection leaves it as the driver's own exception.

The session is opened when the transaction begins and closed when it ends, and every OctaviusTemplate.execute inside the transaction runs through it.

A transaction whose connection is already gone follows two rules. A commit raises, because the work is not durable. A rollback stays quiet, because the server discarded the transaction with the connection, and raising would replace the exception that caused the rollback. The savepoint of Propagation.NESTED follows the same two: releasing it raises, rolling back to it stays quiet.

@Transactional(timeout = ...) is enforced on the server, as timeoutScope names.

OctaviusSpringAutoConfiguration registers it when the application declares no transaction manager of its own.

Constructors

Link copied to clipboard
constructor(dataSource: DataSource)

Properties

Link copied to clipboard

The data source whose connections the transactions run on.

Link copied to clipboard
Link copied to clipboard
protected var logger: Log?
Link copied to clipboard
open override val resourceFactory: Any
Link copied to clipboard

What a transaction's timeout is enforced on: each statement, and a connection that survives one running out, or the transaction as a whole, and a connection that does not. TransactionTimeoutScope.STATEMENT unless set - see TransactionTimeoutScope.

Link copied to clipboard
var transactionExecutionListeners: Collection<TransactionExecutionListener?>?

Functions

Link copied to clipboard
open fun addListener(listener: TransactionExecutionListener?)
Link copied to clipboard
fun commit(status: TransactionStatus?)
Link copied to clipboard
protected open fun determineTimeout(definition: TransactionDefinition?): Int
Link copied to clipboard
protected open override fun doBegin(transaction: Any, definition: TransactionDefinition)

Takes a connection, opens the session over it, begins the transaction, and binds the session to the thread.

Link copied to clipboard
protected open override fun doCleanupAfterCompletion(transaction: Any)
Link copied to clipboard
protected open override fun doCommit(status: DefaultTransactionStatus)

Commits, or raises NetworkException(CONNECTION_ABORTED) for a transaction whose connection is already gone.

Link copied to clipboard
protected open override fun doGetTransaction(): Any

Picks up the session of a transaction this manager is running; one OctaviusTemplate bound is not one.

Link copied to clipboard
protected open override fun doResume(transaction: Any?, suspendedResources: Any)
Link copied to clipboard
protected open override fun doRollback(status: DefaultTransactionStatus)

Rolls back, and stays quiet for a transaction whose connection is already gone.

Link copied to clipboard
protected open override fun doSetRollbackOnly(status: DefaultTransactionStatus)
Link copied to clipboard
protected open override fun doSuspend(transaction: Any): Any
Link copied to clipboard
open override fun getResourceFactory(): Any
Link copied to clipboard
fun getTransaction(definition: @Nullable TransactionDefinition?): TransactionStatus?
Link copied to clipboard
protected fun invokeAfterCompletion(synchronizations: List<TransactionSynchronization?>?, completionStatus: Int)
Link copied to clipboard
protected open override fun isExistingTransaction(transaction: Any): Boolean
Link copied to clipboard
protected open fun prepareForCommit(status: DefaultTransactionStatus?)
Link copied to clipboard
protected open fun prepareSynchronization(status: DefaultTransactionStatus?, definition: TransactionDefinition?)
Link copied to clipboard
protected open fun prepareTransactionalSession(session: OctaviusSession, definition: TransactionDefinition)

Sends the transaction's timeout, where it has one, as the setting timeoutScope names.

protected open fun registerAfterCompletionWithExistingTransaction(transaction: Any?, synchronizations: List<TransactionSynchronization?>?)
Link copied to clipboard
protected fun resume(transaction: @Nullable Any?, resourcesHolder: @Nullable AbstractPlatformTransactionManager.SuspendedResourcesHolder?)
Link copied to clipboard
fun rollback(status: TransactionStatus?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected fun suspend(transaction: @Nullable Any?): @Nullable AbstractPlatformTransactionManager.SuspendedResourcesHolder?
Link copied to clipboard
protected fun triggerBeforeCommit(status: DefaultTransactionStatus?)
Link copied to clipboard
protected fun triggerBeforeCompletion(status: DefaultTransactionStatus?)
Link copied to clipboard