Hi Craig,
> I think what I put into the spec as a sample was before the experts
> agreed on a detached state field.
OK.
> The implementation that you
> propose, using the jdoStateManager and jdoDetachedState works, and I
> can update the spec if no one sees any issues. In fact, we should
> file a JIRA to make sure that this gets fixed.
I'll raise a JIRA but having thought about the original issue (root class not
detachable) and my proposed solution (adding a method jdoGetDetachedState()
to all enhanced classes) it likely needs a change. We already use jdoGetXXX()
for accessors to all fields of the users class, consequently it would be
better to avoid adding a method with a name like that. So what I propose is
Root class be enhanced with the following method
public final boolean jdoIsDetached()
{
return jdoIsDetachedInternal();
}
and if a class is Detachable it also gains the following method
protected boolean jdoIsDetachedInternal()
{
if (jdoStateManager == null)
{
if (jdoDetachedState == null)
return false;
return true;
}
return false;
}
and if a class is not Detachable it gains the following method
protected boolean jdoIsDetachedInternal()
{
return false;
}
This would then cater for the root class not being Detachable, and
subclass(es) being Detachable. An alternative would be to change the
signature of PersistenceCapable.jdoIsDetached to not be final, though maybe
we want to avoid that?
--
Andy