Nested Transactions

A nested transaction is used to provide a transactional guarantee for a subset of operations performed within the scope of a larger transaction. Doing this allows you to commit and abort the subset of operations independently of the larger transaction.

The rules to the usage of a nested transaction are as follows:

To create a nested transaction, simply pass the parent transaction's handle when you created the nested transaction's handle. For example:

    // parent transaction
    Transaction parentTxn = myEnv.beginTransaction(null, null);
    // child transaction
    Transaction childTxn = myEnv.beginTransaction(parentTxn, null);