OpenJPA
  1. OpenJPA
  2. OPENJPA-1582

@OrderColumn(updatable=false) may have the order column field updated

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.0.0-beta2
    • Fix Version/s: 2.0.0, 2.0.1, 2.0.2, 2.1.0
    • Component/s: jdbc
    • Labels:
      None

      Description

      When a collection with orderColumn set updatable=false,

      @ElementCollection//(fetch=FetchType.EAGER)
      @OrderColumn(updatable=false)
      private List<String> nonUpdableAnnotatedElements;

      when collection element is updated, the order column processing performs a delete/insert sequence. The problem is that the implicit order column field is also updated while updatable=false.

        Issue Links

          Activity

          Hide
          Kevin Sutter added a comment -

          Per Fay's remarks and a further investigation of the spec, I think this is working as designed. I'm returning the JIRA so that we can close it out.

          Show
          Kevin Sutter added a comment - Per Fay's remarks and a further investigation of the spec, I think this is working as designed. I'm returning the JIRA so that we can close it out.
          Hide
          Fay Wang added a comment -

          According to Section 11.1.39 of JPA 2.0 spec:

          OrderColumnAnnotation Element "updatable" means:
          (Optional) Whether the column is included in SQL UPDATE statements generated by the persistence provider

          Also in the same section:
          The order column must be of integral type. The persistence provider must maintain a contiguous (non-sparse) ordering of the values of the order column when updating the association or element collection. The order column value for the first element of the list must be 0.

          Two scenarios when an element collection is updated:
          (1) a new element is added:
          OpenJPA will execute an insert statement
          (2) an old element is removed:
          OpenJPA will perform delete/insert

          For scenario (2), the operation is working as design in order to preserver the contiguous ordering of the values of the order column. In addition, no "UPDATE" statement is issued in this operation, which is consistent with what the spec says.

          Show
          Fay Wang added a comment - According to Section 11.1.39 of JPA 2.0 spec: OrderColumnAnnotation Element "updatable" means: (Optional) Whether the column is included in SQL UPDATE statements generated by the persistence provider Also in the same section: The order column must be of integral type. The persistence provider must maintain a contiguous (non-sparse) ordering of the values of the order column when updating the association or element collection. The order column value for the first element of the list must be 0. Two scenarios when an element collection is updated: (1) a new element is added: OpenJPA will execute an insert statement (2) an old element is removed: OpenJPA will perform delete/insert For scenario (2), the operation is working as design in order to preserver the contiguous ordering of the values of the order column. In addition, no "UPDATE" statement is issued in this operation, which is consistent with what the spec says.
          Hide
          Albert Lee added a comment -

          It is related. The old JIRA has fixed what it is intent but it has surfaced
          the new minor concern, hence the new JIRA is opened.

          Albert Lee.


          Albert Lee.

          Show
          Albert Lee added a comment - It is related. The old JIRA has fixed what it is intent but it has surfaced the new minor concern, hence the new JIRA is opened. Albert Lee. – Albert Lee.
          Hide
          Jeremy Bauer added a comment -

          This issue addresses one of the functional aspects of OPENJPA-1074. 1074 also has some performance considerations. Linking the two issues.

          Show
          Jeremy Bauer added a comment - This issue addresses one of the functional aspects of OPENJPA-1074 . 1074 also has some performance considerations. Linking the two issues.
          Hide
          Donald Woods added a comment -

          Is this related to OPENJPA-1074?

          Show
          Donald Woods added a comment - Is this related to OPENJPA-1074 ?

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development