OpenJPA
  1. OpenJPA
  2. OPENJPA-1968

SQLServerDictionery not using DATETIME2 for jdbc driver other than MS JDBC driver

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0, 2.1.1, 2.2.0
    • Fix Version/s: 2.1.1, 2.2.0
    • Component/s: sql
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Use of DATETIME2 db type for Date/Time/Timestamp should based on the SQLServer database version not driver type/vendor.

      As a consequence, if version field is a Timestamp data type, you may get optimistic lock exception due to timestamp precision mismatch and hence update to entity may failed.

      1. TestDDTimestamp.java
        3 kB
        Albert Lee
      2. OPENJPA-1968.patch
        2 kB
        Albert Lee

        Activity

        Hide
        Albert Lee added a comment -

        Even with the current changes in OpenJPA, one may still get the optimistic lock exception due to a problem in the DataDirect 4.2 jdbc driver. A case W103290127 was opened against DataDirect to get this fix. Attached is a test case that reproduce the problem for reference. The problem is openjpa attempts to perform an executeUpdate("DELETE/UPDATE") and the method returns 0 instead of 1 due to timestamp mismatch. As a result, openjpa translates this condition to an optimistic lock exception.

        Show
        Albert Lee added a comment - Even with the current changes in OpenJPA, one may still get the optimistic lock exception due to a problem in the DataDirect 4.2 jdbc driver. A case W103290127 was opened against DataDirect to get this fix. Attached is a test case that reproduce the problem for reference. The problem is openjpa attempts to perform an executeUpdate("DELETE/UPDATE") and the method returns 0 instead of 1 due to timestamp mismatch. As a result, openjpa translates this condition to an optimistic lock exception.

          People

          • Assignee:
            Albert Lee
            Reporter:
            Albert Lee
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development