Making Instances Transactional

When an optimistic transaction is in progress, a persistent-nontransactional instance transitions to persistent-clean if it is a parameter of makeTransactional( ). The values in managed fields of the instance in memory are unchanged. To minimize the possibility of a verification failure at commit, you can first call refresh( ) or refreshAll( ) with the instance as a parameter before making the instance transactional.

It does not matter at what time during the transaction the instance is made transactional. If the verification policy is to compare field values, the values that are compared include at a minimum all of the fields accessed during the 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.