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, use the XmlManager::createTransaction method, but pass it the internal Berkeley DB Transaction object as an argument. For example:

    // parent transaction
    XmlTransaction parentTxn = myManager.createTransaction();
    // child transaction
    XmlTransaction childTxn = 
        XmlManager.createTransaction(parentTxn.getTransaction(), null);