users@glassfish.java.net

Re: How does an explicit EntityManager.lock() call prevent dirty reads in J

From: <glassfish_at_javadesktop.org>
Date: Tue, 11 Nov 2008 18:07:47 PST

This is the spec:

3.4 Optimistic Locking and Concurrency
This specification assumes the use of "optimistic locking". It assumes that the databases to which persistence units are mapped will be accessed by implementations using read-committed isolation (or a vendor equivalent in which long-term read locks are not held), and that writes to the database typically occur only when the flush method has been invoked
[...]
Applications that prefer the use of pessimistic locking may require that database isolation levels higher than read-committed be in effect. The configuration of the setting of such database isolation levels, however, is outside the scope of this specification.
[Message sent by forum member 'mvatkina' (mvatkina)]

http://forums.java.net/jive/thread.jspa?messageID=316188