Transactions
Accesses and updates to persistent instances are performed in the
context of a transaction. The JDO Transaction
interface provides the methods you
use to begin and commit a transaction. It also has methods to manage the
settings of transaction flags. It is similar in functionality to a
javax.transaction.UserTransaction
. Both interfaces have begin(
)
, commit( )
, and rollback( )
methods with the same semantics
and behavior.
A one-to-one relationship exists between a PersistenceManager
and its associated Transaction
instance. A PersistenceManager
instance represents a
single view of persistent data, including persistent instances that have
been cached across multiple serial transactions. If your application
needs multiple concurrent transactions, each transaction will have its
own Transaction
instance and
associated PersistenceManager
instance.
You call methods in the JDO Transaction
interface to perform operations on
a transaction. The underlying datastore has its own representation for a
transaction, with its own operations and interfaces. JDO supports a type
of transaction referred to as a datastore
transaction. This is not the transaction in the underlying
datastore. We refer to the transaction at the datastore level as the
transaction in the datastore, to distinguish it
from the JDO datastore transaction.
Properties of Transactions
Transactions have a set of common properties that are referred to as the ACID (Atomic, Consistent, Isolated, Durable) properties of a transaction. ...
Get Java Data Objects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.