[ 
https://issues.apache.org/jira/browse/OPENJPA-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998140#comment-12998140
 ] 

Michael Dick commented on OPENJPA-1933:
---------------------------------------

I took a look through the documentation, here's my take. 

If you have a persistence.xml file with version=2.0. The proxies will be 
removed if DetachedStateManager=true and 
(IgnoreDetachedStateFieldForProxySerialization=false or is unset). Otherwise 
the proxies will not be removed. 

If you have a persistence.xml file with version=1.0. The proxies should be 
serialized if you call EntityManager.clear() prior to serializing. Otherwise 
(e.g. if you call detach() or detachAll(), or find() ) the proxies will be 
removed. 

This seems to be the opposite of what you've found (but I haven't thoroughly 
looked at the tests) - so you're right - we have a fish in our deserialization 
logic. 

This is a very confusing set of options and we should try to make it clearer in 
a future release, but for now I think we've at least identified the issue. 



> @ElementCollection loose proxytype after serialisation
> ------------------------------------------------------
>
>                 Key: OPENJPA-1933
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1933
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0, 2.0.1
>            Reporter: Mark Struberg
>            Priority: Critical
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-1933-test-2.patch, OPENJPA-1933-test.patch, 
> openjpa-reg-tests.tar.gz
>
>
> usually an @ElementCollection field loaded from the database will be created 
> as a org.apache.openjpa.java$.util$.ArrayListProxy.
> After serialisation/deserialisation (with DetachedStateField=true) the List 
> will be recreated as standard java.util.ArrayList.
> This has the bad side effect, that any subsequent add to this 
> ElementCollection will not set the _dirty field in the DetachedStateManager 
> and any changes in the ElementCollection will not get saved to the database.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to