java - can OptimisticLockException occur if app srv Isolation level is set to READ COMMITTED? -


i using websphere application server 7.0.0.0.9 ;openjpa 1.2.3-snapshot'. have set property of jdbc data source webspheredefaultisolationlevel=2 (read committed). have question because understanding optimasticlockexception occurs if there race commit same row multiple thread. think situation should never occur if isolation level app server set read committed.

this exception getting..

<openjpa-1.2.3-snapshot-r422266:907835 fatal store error> org.apache.openjpa.persistence.optimisticlockexception: optimistic lock violation detected when flushing object instance  

i have question because understanding optimisticlockexception occurs if there race commit same row multiple thread.

yes, optimisticlockexception thrown if version attribute of entity higher (i.e. has been modified transaction) @ commit time when read. illustrated figure below (borrowed jpa 2.0 concurrency , locking):

alt text

but think situation should never occur if isolation level app server set read committed.

why? when using read committed isolation level, non-repeatable reads may occur but:

  1. this won't affect in memory representation of data (e1 in above example)
  2. most of time, don't re-read data
    • and if (and perform non-repeatable read), entity might still modified thread before commit changes.

to sum up, read committed won't prevent optimisticlockexception.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -