What version of OpenJPA are you running?

On Tue, Apr 13, 2010 at 5:54 PM, Angelo K. Huang <[email protected]> wrote:

>
> There are two threads that are concurrently running and want to change the
> same record. Both are using the following fetchplan to lock the object:
>
>                    OpenJPAQuery oq = OpenJPAPersistence.cast(q);
>                    FetchPlan fetch = oq.getFetchPlan();
>                    fetch.setReadLockMode(LockModeType.WRITE);
>                    fetch.setLockTimeout(-1); // no limit
>
>
> I found out both threads can get the record and both hold the lock. If one
> thread wants to change field "Quality" to "GOOD" and the other one wants to
> change to "GREAT", the one committed first will be in the db ,however, the
> other one will be rolled back. Am I right?
>
> How could I do to change this lock behavior so that only one thread can
> hold
> the lock until it commits?
> --
> View this message in context:
> http://n2.nabble.com/ReadLock-Questions-tp4898922p4898922.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
Thanks,
Rick

Reply via email to