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

OrderColumn does not maintain index upon inter-list element removal - Phase 1

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.0-M3
    • Component/s: jdbc
    • Labels:
      None

      Description

      The current order column reordering mechanism does not maintain a contiguous index value when an item is deleted from anywhere except the end of a collection. Per the latest JPA 2.0 spec, a contiguous index value must be maintained.

      The current reordering mechanism does a full delete and reinsert of the container/collection table values if a reorder is required for inserts. For deletes, it just removes entries and leaves an empty index value. The first phase of the fix will be to maintain contiguous ordering using the same mechanism as inserts (delete/re-insert). The second phase will be to update the ChangeTracker to record the indexes of the updated list items and to use that information to provide a more intelligent update strategy in the handlers.

        Issue Links

          Activity

          Hide
          drwoods Donald Woods added a comment -

          Opened OPENJPA-1595 for remaining Phase 2 work.

          Show
          drwoods Donald Woods added a comment - Opened OPENJPA-1595 for remaining Phase 2 work.
          Hide
          drwoods Donald Woods added a comment -

          Splitting the remaining work into a new JIRA, as code was committed using this one and needs to be resolved.

          Show
          drwoods Donald Woods added a comment - Splitting the remaining work into a new JIRA, as code was committed using this one and needs to be resolved.
          Hide
          techhusky Jeremy Bauer added a comment -

          I fixed the non-spec compliant behavior described in this JIRA (ie. phase 1 - Per the latest JPA 2.0 spec, a contiguous index value must be maintained.) but the second phase of the JIRA has not been addressed:

          "The current reordering mechanism does a full delete and reinsert of the container/collection table values if a reorder is required for inserts. For deletes, it just removes entries and leaves an empty index value. The first phase of the fix will be to maintain contiguous ordering using the same mechanism as inserts (delete/re-insert). The second phase will be to update the ChangeTracker to record the indexes of the updated list items and to use that information to provide a more intelligent update strategy in the handlers."

          A more spec related side effect of OpenJPA's current order column update strategy is that the OrderColumn insertable and updatable attributes may not result in the behavior one may expect since the db operations used to maintain the list do not exactly map to the db operations indicated by these attributes.

          I spent a few days looking into implementing phase 2, but it turned into a non trivial exercise.

          Show
          techhusky Jeremy Bauer added a comment - I fixed the non-spec compliant behavior described in this JIRA (ie. phase 1 - Per the latest JPA 2.0 spec, a contiguous index value must be maintained.) but the second phase of the JIRA has not been addressed: "The current reordering mechanism does a full delete and reinsert of the container/collection table values if a reorder is required for inserts. For deletes, it just removes entries and leaves an empty index value. The first phase of the fix will be to maintain contiguous ordering using the same mechanism as inserts (delete/re-insert). The second phase will be to update the ChangeTracker to record the indexes of the updated list items and to use that information to provide a more intelligent update strategy in the handlers." A more spec related side effect of OpenJPA's current order column update strategy is that the OrderColumn insertable and updatable attributes may not result in the behavior one may expect since the db operations used to maintain the list do not exactly map to the db operations indicated by these attributes. I spent a few days looking into implementing phase 2, but it turned into a non trivial exercise.
          Hide
          drwoods Donald Woods added a comment -

          marking non-spec compliant behavior as a critical issue for 2.0.0

          Show
          drwoods Donald Woods added a comment - marking non-spec compliant behavior as a critical issue for 2.0.0

            People

            • Assignee:
              techhusky Jeremy Bauer
              Reporter:
              techhusky Jeremy Bauer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Development