You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Andy Jefferson (JIRA)" <ji...@apache.org> on 2007/01/07 09:42:27 UTC

[jira] Created: (JDO-459) PersistenceCapable.jdoIsDetached needs update to reflect latest

PersistenceCapable.jdoIsDetached needs update to reflect latest
---------------------------------------------------------------

                 Key: JDO-459
                 URL: https://issues.apache.org/jira/browse/JDO-459
             Project: JDO
          Issue Type: Bug
          Components: specification
    Affects Versions: JDO 2 final
            Reporter: Andy Jefferson
             Fix For: JDO 2 maintenance release 1


There are two issues.
1. The JDO2 spec 21.21.3 has a suggested implementation of jdoIsDetached. This was clearly written before we added "jdoDetachedState" to the PersistenceCapable interface and so a StateManager is not present on a detached object.

2. When we have a base class that is not detachable and a subclass that is detachable we have a problem to define PersistenceCapable.jdoIsDetached since the base class has no "jdoDetachedState", and the method is final so cant be overridden by subclasses. We have 2 possible solutions to this. Either we change the signature of jdoIsDetached to not be final (allowing subclasses to override it), or we implement it like this

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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (JDO-459) PersistenceCapable.jdoIsDetached needs update to reflect latest

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell reassigned JDO-459:
---------------------------------

    Assignee: Craig Russell

> PersistenceCapable.jdoIsDetached needs update to reflect latest
> ---------------------------------------------------------------
>
>                 Key: JDO-459
>                 URL: https://issues.apache.org/jira/browse/JDO-459
>             Project: JDO
>          Issue Type: Bug
>          Components: specification
>    Affects Versions: JDO 2 final
>            Reporter: Andy Jefferson
>         Assigned To: Craig Russell
>             Fix For: JDO 2 maintenance release 1
>
>
> There are two issues.
> 1. The JDO2 spec 21.21.3 has a suggested implementation of jdoIsDetached. This was clearly written before we added "jdoDetachedState" to the PersistenceCapable interface and so a StateManager is not present on a detached object.
> 2. When we have a base class that is not detachable and a subclass that is detachable we have a problem to define PersistenceCapable.jdoIsDetached since the base class has no "jdoDetachedState", and the method is final so cant be overridden by subclasses. We have 2 possible solutions to this. Either we change the signature of jdoIsDetached to not be final (allowing subclasses to override it), or we implement it like this
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (JDO-459) PersistenceCapable.jdoIsDetached needs update to reflect latest

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JDO-459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Russell resolved JDO-459.
-------------------------------

    Resolution: Fixed

> PersistenceCapable.jdoIsDetached needs update to reflect latest
> ---------------------------------------------------------------
>
>                 Key: JDO-459
>                 URL: https://issues.apache.org/jira/browse/JDO-459
>             Project: JDO
>          Issue Type: Bug
>          Components: specification
>    Affects Versions: JDO 2 final
>            Reporter: Andy Jefferson
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 1
>
>
> There are two issues.
> 1. The JDO2 spec 21.21.3 has a suggested implementation of jdoIsDetached. This was clearly written before we added "jdoDetachedState" to the PersistenceCapable interface and so a StateManager is not present on a detached object.
> 2. When we have a base class that is not detachable and a subclass that is detachable we have a problem to define PersistenceCapable.jdoIsDetached since the base class has no "jdoDetachedState", and the method is final so cant be overridden by subclasses. We have 2 possible solutions to this. Either we change the signature of jdoIsDetached to not be final (allowing subclasses to override it), or we implement it like this
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JDO-459) PersistenceCapable.jdoIsDetached needs update to reflect latest

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JDO-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12553577 ] 

Craig Russell commented on JDO-459:
-----------------------------------

I've updated the spec.

23.17 Generated methods in least-derived PersistenceCapable class
...
public boolean jdoIsDetached();
This method checks if the instance is detached. If so, it returns true.
For non-detachable classes, this method returns false. If it is detachable, it delegates to the corresponding method in StateManager if the jdoStateManager field is not null. If the jdoStateManager field is null, it returns true if the jdoDetachedState field is not null and false if null.
The method is not final so the implementation can be different for a detachable subclass with a non-detachable superclass.

23.21.3 Generated interrogatives
public boolean jdoIsDetached(){
	if (jdoStateManager!=null) {
		return jdoStateManager.isDetached(this);
	} else return jdoDetachedState != null;
}

24.5 State queries
public boolean isDetached (PersistenceCapable pc);


> PersistenceCapable.jdoIsDetached needs update to reflect latest
> ---------------------------------------------------------------
>
>                 Key: JDO-459
>                 URL: https://issues.apache.org/jira/browse/JDO-459
>             Project: JDO
>          Issue Type: Bug
>          Components: specification
>    Affects Versions: JDO 2 final
>            Reporter: Andy Jefferson
>            Assignee: Craig Russell
>             Fix For: JDO 2 maintenance release 1
>
>
> There are two issues.
> 1. The JDO2 spec 21.21.3 has a suggested implementation of jdoIsDetached. This was clearly written before we added "jdoDetachedState" to the PersistenceCapable interface and so a StateManager is not present on a detached object.
> 2. When we have a base class that is not detachable and a subclass that is detachable we have a problem to define PersistenceCapable.jdoIsDetached since the base class has no "jdoDetachedState", and the method is final so cant be overridden by subclasses. We have 2 possible solutions to this. Either we change the signature of jdoIsDetached to not be final (allowing subclasses to override it), or we implement it like this
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.