You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Mark Struberg <st...@yahoo.de> on 2010/11/29 14:41:04 UTC
DetachedStageManager misere
Hi folks!
I just get grey hairs with the DetachedStateManager
my situation:
.) with default detach strategy
-> error in @PostLoad see OPENJPA-1873
-> error in storing Null Values at em.merge()
.) with detach strategy fetch-groups
-> ElementCollections don't get stored
.) with fgs(DetachedStateField=true)
-> funny crash with improper cast when the entity gets serialized:
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.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
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:540)
at org.apache.openjpa.kernel.StateManagerImpl.writeDetached(StateManagerImpl.java:1478)
at at.ac.tuwien.tiss.education.be.entities.ExamDate.writeExternal(ExamDate.java)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at java.util.ArrayList.writeObject(ArrayList.java:570)
So what to do? I'm willing to spend a reasonable amount of time to create unit tests for those scenarios to help improve OpenJPA. I also already have a medium profound knowledge of OpenJPA internals to help fixing those issues. But I most probably need a few hints to get the right initial direction.
So my first question would be: which detach strategy is the way to go for a standard JSF application which uses the entitymanager-per-request pattern? The default one (loaded)?
txs and LieGrue,
strub