Java Reference
In-Depth Information
TABLE 17-1. Lock Modes for Concurrent Entity Access
Setting the Lock Mode
The lock mode may be specified by one of the following techniques:
• Calling the
EntityManager.lock
and passing in one of the lock modes:
EntityManager em = ...;
Person person = ...;
em.lock(person, LockModeType.OPTIMISTIC);
• Calling one of the
EntityManager.find
methods that takes the lock mode as
a parameter: