← Back to Stormify Documentation

transaction

fun transaction(block: Runnable)

Runs block inside a database transaction. Commits on return, rolls back on any thrown exception. Inside the block, all CRUD/query calls on this wrapper (e.g. stormify.create(user)) transparently run on the transaction's connection via the ambient transaction registry. Nested calls to this method become savepoints automatically.


fun <R> transaction(block: Supplier<R>): R

Returning variant of transaction — see that method for lifecycle semantics.