1. OpenJPA
  2. OPENJPA-2069

Natvie sequence problems uncovered after OPENJPA-1376


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.2, 2.2.0
    • Fix Version/s: 2.2.0
    • Component/s: jdbc, kernel
    • Labels:


      After OPENJPA-1376 commits, it uncovered a few issues, some old and some new.

      1. Backward compatibility - Previous, openjpa relies on the native sequence to provide the next value based on the sequence's INCREMENT BY setting. Now that openjpa manages the next sequence value and allocation size, if the db sequence is manually created that does not match the application's increment and allocation size, committing a new entity may result a constraint violation exception when new sequence value is requested that crossed the allocation boundary. This behavior is indirectly documented in the migration consideration section in the user manual, but it would be better if this can be handled automatically or at least to provide a compatibility option to honor previous behavior.

      2. Initial value always start with the same value (default to 1) - In NativeJDBCSeq, the _initial, _increment and _allocate are used for the CREATE SEQUENCE generation for SynchronizeMapping function. For existing db sequence, next returns whatever managed by the db sequence. After the commit, next will first return the_nextValue value in NativeJDBCSeq until _maxValue is reached, then it go to db to get the sequence's next value, which may be ways off from the current _maxValue.

      3. _nextValue not handled proper when crossing _allocate boundary - When NativeJDBCSeq's _nextValue exceeds the _maxValue boundary, it queries db's sequence for the next incremental value and assign directly as the next return value. It works for incrementBy = 1 but for some value (e.g. 3), the difference of the before and after cross boundary values may NOT be the _increment value.

        Issue Links


          Albert Lee created issue -
          Albert Lee made changes -
          Field Original Value New Value
          Link This issue is related to OPENJPA-1376 [ OPENJPA-1376 ]
          Albert Lee made changes -
          Assignee Albert Lee [ allee8285 ]
          Albert Lee made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.2.0 [ 12315910 ]
          Resolution Fixed [ 1 ]
          Albert Lee made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Kevin Sutter made changes -
          Link This issue relates to OPENJPA-2196 [ OPENJPA-2196 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          9d 18h 11m 1 Albert Lee 14/Nov/11 15:44
          Resolved Resolved Closed Closed
          8s 1 Albert Lee 14/Nov/11 15:44


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


              • Created: