OctaviusJdbcTransactionManager

open class OctaviusJdbcTransactionManager(dataSource: DataSource) : JdbcTransactionManager

A JdbcTransactionManager that tells the truth about a transaction whose connection is already gone.

A connection can leave in the middle of a transaction: the driver aborts one whose stream is broken or that was left mid-COPY, and session.abort() does it on request. Whichever way, the pool evicts it and its proxy answers everything afterwards with a bare java.sql.SQLException carrying neither SQLState nor cause - so there is nothing left for an exception translator to recognise, and Spring's own handling turns both the commit and the rollback into TransactionSystemException: JDBC commit failed.

That matters most on the rollback path, where the rollback runs because something already went wrong: Spring logs Application exception overridden by rollback exception and the failure the caller needed to see is replaced by one about the cleanup.

The two paths are not symmetrical and are not treated as such:

  • Commit must raise. The commit did not happen, and saying nothing would be a claim about durability that is not true.

  • Rollback must not. It is already satisfied - the server discarded the transaction along with the connection - so raising over the top of it buries the real exception to report a cleanup step that had nothing left to do.

Register it in place of JdbcTransactionManager; OctaviusSpringAutoConfiguration does when the application declares no transaction manager of its own.

Constructors

Link copied to clipboard
constructor(dataSource: DataSource)

Properties

Link copied to clipboard
open var dataSource: @Nullable DataSource?
Link copied to clipboard
Link copied to clipboard
open var exceptionTranslator: SQLExceptionTranslator?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected var logger: Log?
Link copied to clipboard
open val resourceFactory: Any?
Link copied to clipboard
var transactionExecutionListeners: Collection<TransactionExecutionListener?>?

Functions

Link copied to clipboard
open fun addListener(listener: TransactionExecutionListener?)
Link copied to clipboard
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 fun doBegin(transaction: Any?, definition: TransactionDefinition?)
Link copied to clipboard
protected open fun doCleanupAfterCompletion(transaction: Any?)
Link copied to clipboard
protected open override fun doCommit(status: DefaultTransactionStatus)
Link copied to clipboard
protected open fun doGetTransaction(): Any?
Link copied to clipboard
protected open fun doResume(transaction: @Nullable Any?, suspendedResources: Any?)
Link copied to clipboard
protected open override fun doRollback(status: DefaultTransactionStatus)
Link copied to clipboard
protected open fun doSetRollbackOnly(status: DefaultTransactionStatus?)
Link copied to clipboard
protected open fun doSuspend(transaction: Any?): 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 fun isExistingTransaction(transaction: Any?): Boolean
Link copied to clipboard
protected open fun obtainDataSource(): DataSource?
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 prepareTransactionalConnection(con: Connection?, definition: TransactionDefinition?)
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
open fun setDatabaseProductName(dbName: String?)
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 open fun translateException(task: String?, ex: SQLException?): RuntimeException?
Link copied to clipboard
protected fun triggerBeforeCommit(status: DefaultTransactionStatus?)
Link copied to clipboard
protected fun triggerBeforeCompletion(status: DefaultTransactionStatus?)
Link copied to clipboard