1.11. Transactions

1.11.1. How does Kodo use transactions?
1.11.2. Does a JDO transaction translate directly to a database transaction?
1.11.1.

How does Kodo use transactions?

The JDO specification defines a javax.jdo.Transaction interface that is similar to a JTA transaction. The JDO application will begin a transaction before making changes to objects, and then commit (or rollback) the transaction once the operation is complete. JDO does not mandate any specific transaction demarcation boundries; the application is free to begin and end transactions in the way that the developer deems suitable. See Chapter 9, Transaction.

1.11.2.

Does a JDO transaction translate directly to a database transaction?

Not necessarily. For optimistic JDO transactions, Kodo will typically only begin a database transaction when the JDO transaction is committed, or if changes are manually flushed to the database. For pessimistic transactions, Kodo will begin a database transaction only once the first objects are acquired and locked.