TransactionPlan
class TransactionPlan
Mutable container for building a sequence of database operations to be executed atomically.
Collects TransactionStep instances and their corresponding StepHandles, enabling deferred execution within a single transaction via org.octavius.data.DataAccess.executeTransactionPlan.
Useful when transaction steps need to be constructed dynamically based on runtime data (e.g., form submissions with variable number of related entities).
Usage Example
val plan = TransactionPlan()
val userHandle = plan.add(
dataAccess.insertInto("users").values(userData).asStep().toField<Int>()
)
plan.add(
dataAccess.insertInto("profiles")
.values(mapOf("user_id" to userHandle.field()))
.asStep().execute()
)
dataAccess.executeTransactionPlan(plan)Content copied to clipboard