3.5. Creating an Object
After a PersistenceManager has been retrieved, it is possible to actually begin a transaction and do something interesting with the datastore. To begin a transaction, get the current Transaction instance from the PersistenceManager:
public Transaction currentTransaction()
And call the begin() method on Transaction to start a datastore transaction:
public void begin()
Typically, any interaction with a datastore is done within the context of a transaction. A transaction simply marks the beginning and end of a unit of work, whereby all changes made either happen or do not happen.
A transaction is also the mechanism that a datastore uses to enforce concurrency control between multiple applications accessing the datastore ...
Get Core 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.