[
https://issues.apache.org/jira/browse/OPENJPA-1900?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966269#action_12966269
]
Mark Struberg commented on OPENJPA-1900:
----------------------------------------
The Externalizable field gets added if I use the openjpa.DetachStage
fetch-groups(DetachStateField=true)
This is an issues in our test suite currently - it uses different
persistence.xml for enhancing
(${project.build.testOutputDirectory}/META-INF/nopriv_persistence.xml) and
running the tests (org/apache/openjpa/persistence/proxy/persistence1.xml)
Thus my test currently succeeds but only because this isn't a real world
scenario.
PS: took me a while to figure this, but at least I'm now pretty deep into
OpenJPA internals :D
> ClassCastException when serializing an entity if DetachedStateField=true
> ------------------------------------------------------------------------
>
> Key: OPENJPA-1900
> URL: https://issues.apache.org/jira/browse/OPENJPA-1900
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Affects Versions: 2.0.1, 2.1.0
> Reporter: Mark Struberg
> Fix For: 2.1.0
>
> Attachments: OPENJPA-1900-test-1.patch
>
>
> When using
> <property name="openjpa.DetachState"
> value="fetch-groups(DetachedStateField=true)"/>
> serializing an entity leads to the following Exception:
> java.lang.ClassCastException: org.apache.openjpa.kernel.StateManagerImpl
> cannot be cast to org.apache.openjpa.kernel.DetachedStateManager
> at org.apache.openjpa.util.Proxies.writeReplace(Proxies.java:147)
> at org.apache.openjpa.util.java$util$Date$proxy.writeReplace(Unknown
> Source)
> at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1032)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1107)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> at
> org.apache.openjpa.kernel.SingleFieldManager.serialize(SingleFieldManager.java:545)
> at
> org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
> at
> at.ac.tuwien.tiss.curriculum.be.entities.CurriculumVersion.writeExternal(CurriculumVersion.java)
> at
> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
> This seems related to OPENJPA-1597
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.