Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1608

PESSIMISTIC_WRITE is not working in Informix

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: jdbc
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      The following call:

      district = em.find(DistrictJPA.class, key, LockModeType.PESSIMISTIC_WRITE);

      generates SELECT ... FOR UPDATE .

      However, in the default isolation level (read committed). Informix does not lock the row, causing a lot of duplicate key errors. The work around is for the application to explicitly set the property below in the persistence.xml:

      <property name="openjpa.jdbc.TransactionIsolation" value="repeatable-read" />

      According to the spec 3.4.4, footnote:

      For example, a persistence provider may use an underlying database platform's SELECT FOR UPDATE statements to implement pessimistic locking if that construct provides appropriate semantics, or the provider may use an isolation level of repeatable read.

      It appears that the persistence provider must implements PESSIMISTIC_WRITE semantics transparently to the application.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                faywang Fay Wang
                Reporter:
                faywang Fay Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: