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

Pessimistic Lock not honour when ORDER BY clause is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-M3
    • 2.0.0-beta
    • query
    • None

    Description

      query = em.createQuery(
      "select e.department from Employee e where e.id < 10 order by e.department.id").setFirstResult(3);
      query.setLockMode(LockModeType.PESSIMISTIC_READ);
      q = query.getResultList();

      yields the following SQL statement but with no lock on the Employee row:

      openjpa.Runtime: Info: The database is unable to lock this query. Each object matching the query will be locked individually after it is loaded; however, it is technically possible that another transaction could modify the data before the lock is obtained. See the documentation on Object Locking for details.
      "SELECT t1.ID, t1.NAME, t0.FK_DEPT FROM CTS1.EMPLOYEE t0 LEFT OUTER JOIN CTS1.DEPARTMENT t1 ON t0.FK_DEPT = t1.ID WHERE (t0.ID < CAST(? AS BIGINT)) ORDER BY t0.FK_DEPT ASC "
      openjpa.jdbc.SQL: Trace: <t 2035185998, conn 1784113751> executing prepstmnt 1845128698 SELECT t1.ID, t1.NAME, t0.FK_DEPT FROM CTS1.EMPLOYEE t0 LEFT OUTER JOIN CTS1.DEPARTMENT t1 ON t0.FK_DEPT = t1.ID WHERE (t0.ID < CAST(? AS BIGINT)) ORDER BY t0.FK_DEPT ASC [params=(long) 10]

      Attachments

        Activity

          People

            allee8285 Albert Lee
            allee8285 Albert Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: