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 17:35:31 PST

marina,

How would you fix vladbalan's original example? Looking at slide 42:

[code]em.lock(d1, WRITE);
em.flush(); //version++ for d1[/code]

This looks like it'll issue an SQL "update" on the database which acquires a row-lock on most databases. It doesn't sound like even this approach would help vladbalan since one thread is only reading, not writing.
[Message sent by forum member 'cowwoc' (cowwoc)]

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