DekGenius.com
[ Team LiB ] Previous Section Next Section

15.2 Optimistic Transaction State Transitions

With the Optimistic flag set to true, some of the behavior of the cache changes, due to the requirements of verification at commit time. Primarily, the JDO implementation saves the state of the instances that are updated or deleted, so it can verify the instances at commit.

If a persistent field other than one of the primary-key fields is read, a hollow instance transitions to persistent-nontransactional instead of persistent-clean. Subsequent reads of any of these fields in the same transaction do not cause a transition from persistent-nontransactional.

Note that the fields in persistent-nontransactional instances might be read from the datastore at different times, either outside transactions or during transactions where the RetainValues property is set to true.

If the first access to a hollow instance in an optimistic transaction is a write access, the hollow instance transitions to persistent-dirty. During the transition, the JDO implementation fetches the instance from the datastore and saves the state of the instance for verification at commit. These state transitions are shown in Figure 15-2.

Figure 15-2. State transitions during optimistic transactions
figs/jdo_1502.gif
    [ Team LiB ] Previous Section Next Section