datanucleus-core
datanucleus-core copied to clipboard
Enhancement contract : cater for serialisation of detachedState when user has overridden writeObject/writeReplace without calling "defaultWriteObject"
The enhancement contract will cater for normal Java serialisation where a user doesn't change the default process, OR where they make use of out.defaultWriteObject()
. The dnDetachedState
field is serialised/deserialised since not transient.
If the user deviates from this then it will not be serialised, and hence detached state is lost.
We would want to detect the overriding of writeObject
/writeReplace
and the absence of a call to defaultWriteObject
(defaultReadObject
) and in that case add on
out.writeObject(dnDetachedState);
as well as
dnDetachedState = (Object[])in.readObject();