Clean up detach on serialize and ensure declared constructors are properly

public for externalize


git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@430303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Kim 2006-08-10 08:14:18 +00:00
parent 3e758faf25
commit 07a13ab908
3 changed files with 13 additions and 2 deletions

View File

@ -2892,6 +2892,15 @@ public class PCEnhancer {
private void addDetachExternalize(boolean parentDetachable,
boolean detachedState)
throws NoSuchMethodException {
// ensure that the declared default constructor is public
// for externalization
BCMethod meth = _pc.getDeclaredMethod("<init>", (String[]) null);
if (!meth.isPublic()) {
if (_log.isWarnEnabled())
_log.warn(_loc.get("enhance-defcons-extern",
_meta.getDescribedType()));
meth.makePublic();
}
// declare externalizable interface
if (!Externalizable.class.isAssignableFrom(_meta.getDescribedType()))
_pc.declareInterface(Externalizable.class);

View File

@ -89,9 +89,9 @@ public class DetachManager
if (setState) {
sm.getPersistenceCapable().pcSetDetachedState(getDetachedState
(sm, idxs));
return true;
return false; // don't null state
}
return false;
return true;
}
/**

View File

@ -44,6 +44,8 @@ enhance-uid-access: An IllegalAccessException occured when trying to \
class that implements java.io.Serializable. If compatibility with \
non-enhanced versions of "{0}" is not needed, this warning can be ignored.
enhance-oid: Enhancing object id type "{0}" to allow member access.
enhance-defcons-extern: Type "{0}" requires a public constructor to support \
detach on serialize. Making default constructor public.
cons-access: An error occurred trying to instantiate a custom storage class.
pcdata-generate: Generating dynamic PCData for type: "{0}"
pcdata-created: Dynamic PCData created: name="{0}", for type="{1}"