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 <an...@jpox.org> on 2006/02/06 17:31:43 UTC

deletePersistent() with a detached object

What is the expected behaviour when calling deletePersistent() with a detached
object ?
Spec section 12.6.7 doesn't explicitly mention it.

Since makePersistent() will now take detached objects and persist them, I would
probably expect deletePersistent() to perform the deletion of the underlying
persistent object (if it is persistent in this datastore). Is this a correct
understanding ?

Thanks
-- 
Andy

RE: Negative VOTE Issue 156: deletePersistent() with a detached object

Posted by "Matthew T. Adams" <ma...@xcalia.com>.
+1, then, from me.

>-----Original Message-----
>From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] 
>Sent: Monday, February 06, 2006 2:38 PM
>Cc: Apache JDO project; JDO Expert Group
>Subject: Re: Negative VOTE Issue 156: deletePersistent() with 
>a detached object
>
>
>I agree.
>
>Craig
>
>On Feb 6, 2006, at 2:27 PM, Matthew T. Adams wrote:
>
>>   If there are any
>> InstanceLifecycleListeners registered for deletion callbacks of
>> instances of the detached object's class, the persistent instance
>> is instantiated and passed to the listener in the event object
>> as described in section 12.15.
>
>Craig Russell
>Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>408 276-5638 mailto:Craig.Russell@sun.com
>P.S. A good JDO? O, Gasp!
>
>



Re: Negative VOTE Issue 156: deletePersistent() with a detached object

Posted by Craig L Russell <Cr...@Sun.COM>.
I agree.

Craig

On Feb 6, 2006, at 2:27 PM, Matthew T. Adams wrote:

>   If there are any
> InstanceLifecycleListeners registered for deletion callbacks of
> instances of the detached object's class, the persistent instance
> is instantiated and passed to the listener in the event object
> as described in section 12.15.

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


RE: Negative VOTE Issue 156: deletePersistent() with a detached object

Posted by "Matthew T. Adams" <ma...@xcalia.com>.
I agree, but would add specific verbage in the event that any
InstanceLifecycle listeners would receive callbacks as well:

<proposed version="2">
If the parameter instance of deletePersistent() is a detached  
instance, the method applies to the associated persistent instance.  
Similarly, if any of the parameter instances of deletePersistentAll()  
is a detached instance, the method applies to the associated  
persistent instances.  If the class of instances to be deleted  
implements the delete callback, then the persistent instance is  
instantiated and the callback is executed.  If there are any
InstanceLifecycleListeners registered for deletion callbacks of 
instances of the detached object's class, the persistent instance
is instantiated and passed to the listener in the event object
as described in section 12.15.
</proposed>

>-----Original Message-----
>From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] 
>Sent: Monday, February 06, 2006 2:01 PM
>To: jdo-dev@db.apache.org
>Cc: andy@jpox.org; jdo-experts-ext@Sun.COM
>Subject: Negative VOTE Issue 156: deletePersistent() with a 
>detached object
>
>
>Javadogs,
>
>I agree. Here's a proposed spec update for 12.6.7:
>
><proposed>
>If the parameter instance of deletePersistent() is a detached  
>instance, the method applies to the associated persistent instance.  
>Similarly, if any of the parameter instances of deletePersistentAll()  
>is a detached instance, the method applies to the associated  
>persistent instances.  If the class of instances to be deleted  
>implements the delete callback, then the persistent instance is  
>instantiated and the callback is executed.
></proposed>
>
>Craig
>
>On Feb 6, 2006, at 8:54 AM, Matthew T. Adams wrote:
>
>> I would say that yes, this is correct, but what happens if the  
>> corresponding
>> persistent instance implements DeleteCallback?  I think that the  
>> spec should
>> require the implementation to load the persistent instance and call  
>> its
>> jdoPreDelete() method, and call any lifecycle listener methods that  
>> may be
>> registered to listen for the deletion of objects of the deleted  
>> object's
>> class.
>>
>> --matthew
>>
>>> -----Original Message-----
>>> From: Andy Jefferson [mailto:andy@jpox.org]
>>> Sent: Monday, February 06, 2006 8:32 AM
>>> To: jdo-dev@db.apache.org; jdo-experts-ext@Sun.COM
>>> Subject: deletePersistent() with a detached object
>>>
>>>
>>> What is the expected behaviour when calling deletePersistent()
>>> with a detached
>>> object ?
>>> Spec section 12.6.7 doesn't explicitly mention it.
>>>
>>> Since makePersistent() will now take detached objects and
>>> persist them, I would
>>> probably expect deletePersistent() to perform the deletion of
>>> the underlying
>>> persistent object (if it is persistent in this datastore). Is
>>> this a correct
>>> understanding ?
>>>
>>> Thanks
>>> -- 
>>> Andy
>>>
>>
>>
>
>Craig Russell
>Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>408 276-5638 mailto:Craig.Russell@sun.com
>P.S. A good JDO? O, Gasp!
>
>



Negative VOTE Issue 156: deletePersistent() with a detached object

Posted by Craig L Russell <Cr...@Sun.COM>.
Javadogs,

I agree. Here's a proposed spec update for 12.6.7:

<proposed>
If the parameter instance of deletePersistent() is a detached  
instance, the method applies to the associated persistent instance.  
Similarly, if any of the parameter instances of deletePersistentAll()  
is a detached instance, the method applies to the associated  
persistent instances.  If the class of instances to be deleted  
implements the delete callback, then the persistent instance is  
instantiated and the callback is executed.
</proposed>

Craig

On Feb 6, 2006, at 8:54 AM, Matthew T. Adams wrote:

> I would say that yes, this is correct, but what happens if the  
> corresponding
> persistent instance implements DeleteCallback?  I think that the  
> spec should
> require the implementation to load the persistent instance and call  
> its
> jdoPreDelete() method, and call any lifecycle listener methods that  
> may be
> registered to listen for the deletion of objects of the deleted  
> object's
> class.
>
> --matthew
>
>> -----Original Message-----
>> From: Andy Jefferson [mailto:andy@jpox.org]
>> Sent: Monday, February 06, 2006 8:32 AM
>> To: jdo-dev@db.apache.org; jdo-experts-ext@Sun.COM
>> Subject: deletePersistent() with a detached object
>>
>>
>> What is the expected behaviour when calling deletePersistent()
>> with a detached
>> object ?
>> Spec section 12.6.7 doesn't explicitly mention it.
>>
>> Since makePersistent() will now take detached objects and
>> persist them, I would
>> probably expect deletePersistent() to perform the deletion of
>> the underlying
>> persistent object (if it is persistent in this datastore). Is
>> this a correct
>> understanding ?
>>
>> Thanks
>> -- 
>> Andy
>>
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


RE: deletePersistent() with a detached object

Posted by "Matthew T. Adams" <ma...@xcalia.com>.
I would say that yes, this is correct, but what happens if the corresponding
persistent instance implements DeleteCallback?  I think that the spec should
require the implementation to load the persistent instance and call its
jdoPreDelete() method, and call any lifecycle listener methods that may be
registered to listen for the deletion of objects of the deleted object's
class.

--matthew

>-----Original Message-----
>From: Andy Jefferson [mailto:andy@jpox.org] 
>Sent: Monday, February 06, 2006 8:32 AM
>To: jdo-dev@db.apache.org; jdo-experts-ext@Sun.COM
>Subject: deletePersistent() with a detached object
>
>
>What is the expected behaviour when calling deletePersistent() 
>with a detached
>object ?
>Spec section 12.6.7 doesn't explicitly mention it.
>
>Since makePersistent() will now take detached objects and 
>persist them, I would
>probably expect deletePersistent() to perform the deletion of 
>the underlying
>persistent object (if it is persistent in this datastore). Is 
>this a correct
>understanding ?
>
>Thanks
>-- 
>Andy
>