JdbcTransactionProvider

Interface for managing database connections and transactions. Decouples the core logic from specific transaction management implementations (like Spring).

Each DataAccess instance is backed by exactly one JdbcTransactionProvider.

Inheritors

Properties

Link copied to clipboard
abstract val dataSource: DataSource

The underlying data source used for obtaining connections.

Functions

Link copied to clipboard
abstract fun applyTimeout(statement: Statement)

Applies the current transaction timeout to the given statement.

Link copied to clipboard
abstract fun <T> execute(propagation: TransactionPropagation, isolation: IsolationLevel = IsolationLevel.DEFAULT, readOnly: Boolean = false, timeoutSeconds: Int? = null, block: (TransactionStatus) -> T): T

Executes a block of code within a transaction context.

Link copied to clipboard
abstract fun getConnection(): Connection

Obtains a connection for the current execution context. If a transaction is active, returns the connection bound to that transaction. Otherwise, returns a new connection from the dataSource.

Link copied to clipboard
abstract fun releaseConnection(connection: Connection)

Releases the given connection. If the connection is part of an active transaction, it is NOT closed. Otherwise, it is returned to the pool (closed).