Nontransactional Features

As you have seen earlier, the JDO runtime contains an instance cache managed by the PersistenceManager, and in the transaction modes we have presented thus far, instances in the cache have always been transactional. We now introduce the behavior of the cache and the instances contained in the cache in light of nontransactional behavior. There are five independent flags that govern this behavior.

NontransactionalRead

This flag enables your application to iterate extents, perform queries, access persistent values of persistent instances, and navigate the entire graph of persistent instances, without having a transaction active.

NontransactionalWrite

This flag enables your application to make changes to the cache that will never be committed to the datastore. Most applications expect that changes made to persistent instances will be stored in the datastore at some point. NontransactionalWrite caters to applications that manage a cache of persistent instances where the changes to the datastore are made by a different application.

Optimistic

This flag enables your application to execute transactions that improve the concurrency of datastore access, by deferring locking of data until commit. We discuss optimistic transactions in detail in Chapter 15; we introduce it here because instances used in an optimistic transaction are read nontransactionally, so they share common characteristics of data that is read with NontransactionalRead.

RetainValues

This flag enables your ...

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.