You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Helen Xu (JIRA)" <ji...@apache.org> on 2012/08/17 19:08:37 UTC

[jira] [Created] (OPENJPA-2252) Unexpected update statement when merging a serialized and no-change entity with the embedded field

Helen Xu created OPENJPA-2252:
---------------------------------

             Summary: Unexpected update statement when merging a serialized and no-change entity with the embedded field
                 Key: OPENJPA-2252
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2252
             Project: OpenJPA
          Issue Type: Bug
          Components: sql
    Affects Versions: 2.2.0, 2.1.1, 2.0.1, 2.3.0
            Reporter: Helen Xu
            Assignee: Helen Xu


The unexpected update statement was observed when merging a serialized and deserialized entity which has no change and contains the embedded field.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2252) Unexpected update statement when merging a serialized and no-change entity with the embedded field

Posted by "Heath Thomann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437995#comment-13437995 ] 

Heath Thomann commented on OPENJPA-2252:
----------------------------------------

Hi Helen!  Does your fix still require openjpa.DetachState="DetachedStateField=true" to be set?  As I understand it, the extra update only occurs when an entity, which contains an Embeddable, is serialized/deserialized and then merged.  In this case, when an entity is serialized, some of its state (detached state) is removed (i.e. this state is transient).  As such, when the entity is merged, state necessary for OpenJPA to determine if the entity should be updated is not available.  In order for necessary state to be serialized with the entity, a 'DetachedStateField' needs to be used.....this field will aid OpenJPA during the merge.  Is my understanding correct?  If so, then I'm assuming that even with your fix, we still need a 'DetachedStateField' to preserves the necessary state across serialization boundaries in order to help OpenJPA determine if an update is needed during a merge?

                
> Unexpected update statement when merging a serialized and no-change entity with the embedded field
> --------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2252
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2252
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2252.patch
>
>
> The unexpected update statement was observed when merging a serialized and deserialized entity which has no change and contains the embedded field.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (OPENJPA-2252) Unexpected update statement when merging a serialized and no-change entity with the embedded field

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436892#comment-13436892 ] 

Helen Xu commented on OPENJPA-2252:
-----------------------------------

The extra update is from the wrong checking in VersionAttachStrategy.attach to determine if the attaching entity is new or not. When it calls the BrokerImpl.isDetached, it returns false for the embedded field since it has no pcIsDetached method after serialization and deserialzation plus there is no OID for embedded field. The embedded field shouldn't be treated as new instance when it has not null owner entity. With the change I posted, it fixed the problem. I also added more test cases to make sure it doesn't break other cases. All the other junit tests passed as well when I run "mvn clean install"
                
> Unexpected update statement when merging a serialized and no-change entity with the embedded field
> --------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2252
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2252
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2252.patch
>
>
> The unexpected update statement was observed when merging a serialized and deserialized entity which has no change and contains the embedded field.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2252) Unexpected update statement when merging a serialized and no-change entity with the embedded field

Posted by "Albert Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee updated OPENJPA-2252:
--------------------------------

    Patch Info: Patch Available
    
> Unexpected update statement when merging a serialized and no-change entity with the embedded field
> --------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2252
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2252
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2252.patch
>
>
> The unexpected update statement was observed when merging a serialized and deserialized entity which has no change and contains the embedded field.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-2252) Unexpected update statement when merging a serialized and no-change entity with the embedded field

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2252:
------------------------------

    Attachment: OPENJPA-2252.patch

test case and attempt fix attached.
                
> Unexpected update statement when merging a serialized and no-change entity with the embedded field
> --------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2252
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2252
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0, 2.3.0
>            Reporter: Helen Xu
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2252.patch
>
>
> The unexpected update statement was observed when merging a serialized and deserialized entity which has no change and contains the embedded field.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira