TransactionDefinition

data class TransactionDefinition(val propagation: TransactionPropagation = TransactionPropagation.REQUIRED, val isolation: TransactionIsolationLevel? = null, val readOnly: Boolean = false, val statementTimeout: Duration? = null, val transactionTimeout: Duration? = null)

How a transaction should be run.

Gathered into one value rather than passed as five parameters because it is what a SessionProvider is handed, and providers differ in what they can honour: the default one sets everything here on the session it opens, while one backed by another transaction manager may own some of these itself.

Constructors

Link copied to clipboard
constructor(propagation: TransactionPropagation = TransactionPropagation.REQUIRED, isolation: TransactionIsolationLevel? = null, readOnly: Boolean = false, statementTimeout: Duration? = null, transactionTimeout: Duration? = null)

Properties

Link copied to clipboard

The isolation level to run at, or null to leave the session on the level the server gave it. Applied only where this definition actually starts a transaction - joining one that is already running cannot change the level it began at.

Link copied to clipboard

What to do about a transaction that is already running. Defaults to TransactionPropagation.REQUIRED.

Link copied to clipboard

Whether the transaction refuses writes. Applied on the same terms as isolation.

Link copied to clipboard

Aborts any single statement in the transaction that runs longer than this, via SET LOCAL statement_timeout. null leaves the server's setting alone.

Link copied to clipboard

Aborts the transaction once it has been open longer than this, via SET LOCAL transaction_timeout. null leaves the server's setting alone.