required
Executes the given block within a transaction scope.
If a transaction is currently active (autoCommit = false), the block will be executed within the existing transaction. Otherwise, a new transaction is started, and it will be committed upon successful completion, or rolled back if an exception occurs.
Inside the block, manual transaction operations such as commit, rollback, and autoCommit modifications are not accessible as the receiver is restricted to OctaviusSessionOperations. A return out of the block does not compile either - use return@required, since an early exit would otherwise commit whatever the block had already done, which is the same decision the restricted receiver is there to keep out of the block.
Whatever of isolation, readOnly, statementTimeout and transactionTimeout is asked for goes out right behind the BEGIN, and both go with the block's first statement - at no round trip of their own, and not at all where the block runs no statement. A term the server refuses fails that first statement, inside the block, so it rolls back like any other failure - and so does one sent at once because a hand-written BEGIN had already opened the transaction. All four end with the transaction, which is what separates them from OctaviusSessionOperations.transactionIsolationLevel and OctaviusSessionOperations.readOnly - those are session-wide, and are not what this sets.
A transaction already running keeps the terms it began at: none of the four applies, and a warning names them.
Return
The result of the block.
Parameters
The isolation level for this transaction, or null for the session's.
Whether this transaction refuses writes.
Aborts any single statement in this transaction that runs longer than this.
Aborts this transaction once it has been open longer than this.
The block of code to execute.