readonlyTx

fun <T> readonlyTx(db: Database? = null, transactionIsolation: Int? = db?.transactionManager?.defaultIsolationLevel, statement: JdbcTransaction.() -> T): T

Executes a read-only database transaction.

Called inside another transaction, this does not start a new one: with Exposed's default useNestedTransactions = false the block joins the outer transaction, and with nesting on it inherits the outer transaction's read-only flag and isolation level. Either way, transactionIsolation and read-only mode (where applicable) are not applied, and only an outermost call commits.

Return

the result of statement

Parameters

db

the Database to use, or null for the default database

transactionIsolation

the JDBC transaction isolation level

statement

the transaction body to execute

Type Parameters

T

the return type of the transaction