How can I share a transaction between Berkeley DB and BDB XML?
The transacted methods in BDB XML all take an XmlTransaction object. This object can be constructed using an already-created Berkeley DB transaction object. Another mechanism is to get the Berkeley DB object from the BDB XML XmlTransaction object. The thing to avoid is creating two unrelated transaction objects that may conflict with one another. In C++, to construct an XmlTransaction from DbTxn: DbTxn *dbtxn = 0; // use Berkeley DB environment to begin a transaction env.txn_begin(0, &dbtxn, 0); … // create XmlTransaction from DbTxn XmlTransaction xmltxn = manager.createTransaction(dbtxn); In C++, to obtain a DbTxn from XmlTransaction: XmlTransaction xmltxn = manager.createTransaction(); // get DbTxn DbTxn *dbtxn = xmltxn.getDbTxn(); When using DbTxn and XmlTransaction together, a couple of rules are important. Once a transaction is committed or aborted, the underlying DbTxn object will have been deleted, and must not be referenced again. Also, a DbTxn object may only be referenced b