executeTransactionPlan

abstract fun executeTransactionPlan(plan: TransactionPlan, propagation: TransactionPropagation = TransactionPropagation.REQUIRED, isolation: IsolationLevel = IsolationLevel.DEFAULT, readOnly: Boolean = false, statementTimeout: Duration? = null, transactionTimeout: Duration? = null): DataResult<TransactionPlanResult>

Executes a pre-configured TransactionPlan as a single, atomic transaction.

Transaction Plans are specifically designed for scenarios where the sequence of operations is determined dynamically (e.g., at the service or UI layer) and steps may depend on results from previous operations (via StepHandle).

Return

DataResult containing the results of all steps in the plan on success, or a DatabaseException on failure.

Parameters

plan

The pre-built plan containing steps to be executed.

propagation

Specifies how this transaction should behave if another transaction is already active. Defaults to TransactionPropagation.REQUIRED.

isolation

The isolation level for the transaction.

readOnly

If true, prevents modifications to the database during this transaction.

statementTimeout

Aborts any individual statement within this transaction that takes longer than the specified time. Note: Supported only in Core Provider (SET LOCAL statement_timeout). Not supported and throws io.github.octaviusframework.db.api.exception.BadStatementException when using Spring integration.

transactionTimeout

Aborts the entire transaction if it exceeds this time. In Core Provider, this uses SET LOCAL transaction_timeout (Requires PostgreSQL 17+). In Spring integration, this maps to Spring's transaction deadline logic.