Persistent-Nontransactional State

The use of instances outside a transaction introduces another instance lifecycle state: persistent-nontransactional . From the application program perspective, this state is indistinguishable from the hollow state. That is, the results of executing the interrogatives in JDOHelper (isNew( ), isDirty( ), etc.) are the same for instances in both states. Your application generally should not be aware of the difference between instances in the hollow and persistent-nontransactional states.

From a performance perspective, your application might run faster, because accessing field values of instances in the persistent-nontransactional state might be done without a datastore access. Your application can retrieve field values cached in the instance and navigate the object graph to other instances, relying only on the cached values. The only time the datastore must be accessed is when a field that has not yet been loaded from the datastore is read.

With datastore transactions, existing persistent instances begin their lifecycle in the cache as persistent-clean or persistent-dirty. With the first access to persistent instances outside a transaction, they begin their lifecycle in the cache in the persistent-nontransactional state. This can be the result of an Extent iteration, a query execution, or navigation from another persistent-nontransactional instance.

With NontransactionalRead set to true, outside a transaction:

  • Your application can read field values, ...

Get Java Data Objects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.