You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fay Wang (JIRA)" <ji...@apache.org> on 2010/09/21 19:10:32 UTC

[jira] Commented: (OPENJPA-1582) @OrderColumn(updatable=false) may have the order column field updated

    [ 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.