English | 简体中文

api-docs / org.ktorm.database / JdbcTransactionManager

JdbcTransactionManager

class JdbcTransactionManager : TransactionManager (source code)

TransactionManager implementation based on JDBC.

This class is capable of working in any environment with any JDBC driver. It accepts a connector
function used to obtain SQL connections. Applications should return a native JDBC connection in
the callback function, no matter it’s newly established by DriverManager directly, or obtained
from a connection pool such as DataSource.

Database instances created by Database.connect functions use this implementation by default.

Constructors

NameSummary

<init>

JdbcTransactionManager(connector: () -> Connection)

TransactionManager implementation based on JDBC.

Properties

NameSummary

connector

val connector: () -> Connection

the callback function used to obtain SQL connections.

currentTransaction

val currentTransaction: Transaction?

The opened transaction of the current thread, null if there is no transaction opened.

defaultIsolation

val defaultIsolation: TransactionIsolation?

The default transaction isolation, null for the default isolation level of the underlying datastore.

Functions

NameSummary

newConnection

fun newConnection(): Connection

Create a native JDBC connection to the database.

newTransaction

fun newTransaction(
    isolation: TransactionIsolation?
): Transaction

Open a new transaction for the current thread using the specific isolation if there is no transaction opened.

Extension Functions

NameSummary

eq

infix fun <T : Any> T.eq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Equal operator, translated to = in SQL.

neq

infix fun <T : Any> T.neq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Not-equal operator, translated to <> in SQL.

notEq

infix fun <T : Any> T.notEq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Not-equal operator, translated to <> in SQL.