[
https://issues.apache.org/jira/browse/OPENJPA-1582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913085#action_12913085
]
Fay Wang commented on OPENJPA-1582:
-----------------------------------
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.
> @OrderColumn(updatable=false) may have the order column field updated
> ---------------------------------------------------------------------
>
> Key: OPENJPA-1582
> URL: https://issues.apache.org/jira/browse/OPENJPA-1582
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 2.0.0-beta2
> Reporter: Albert Lee
> Priority: Minor
>
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.