db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Issue 135: Remove attachCopy from PersistenceManager
Date Wed, 02 Nov 2005 16:24:45 GMT
Hi,


On Nov 2, 2005, at 7:30 AM, Michael Bouschen wrote:

> Hi Jörg,
>
> good catch! Yes, the examples are meant to use two different  
> PersistenceManagers pm1 and pm2.
>
> I think JDOHelper.shallowCopy would work for any instance of a  
> persistence capable class, not only for detached instances.
>
The semantics of JDOHelper.shallowCopyAll would be to make an object  
graph suitable for attachment. So there would be a copy made of  
transient and detached instances but persistent instances would not  
be copied.

Perhaps shallowCopyAll isn't the right name since we don't shallow  
copy persistent instances. Maybe something like copyForAttachment or  
something like it.
>
> Regards Michael

Regards,

Craig
>
>
>> Craig L Russell schrieb:
>>
>>> With this change,  there is no standard way to attach the same  
>>> object  graph to multiple persistence managers. So a method is  
>>> added to  JDOHelper that copies a complete object graph so the  
>>> copies can be  attached to multiple persistence managers.
>>>
>>> Instead of:
>>> Object[ ] attached1 = pm.attachCopy(graph);
>>> Object[ ] attached2 = pm.attachCopy(graph);
>>>
>>> use:
>>> Object[ ] copies = JDOHelper.shallowCopy(graph, false);
>>> Object[ ] attached1 = pm.makePersistentAll(copies);
>>> Object[ ] attached2 = pm.makePersistentAll(copies);
>>>
>> There is only one and the same persistence manager being used in  
>> these examples, shouldn't it be more like:
>>    Instead of:
>>    Object[ ] attached1 = pm1.attachCopy(graph);
>>    Object[ ] attached2 = pm2.attachCopy(graph);
>>    use:
>>    Object[ ] copies = JDOHelper.shallowCopy(graph, false);
>>    Object[ ] attached1 = pm1.makePersistentAll(copies);
>>    Object[ ] attached2 = pm2.makePersistentAll(copies);
>> BTW, is JDOHelper.shallowCopy() supposed to work only on a  
>> detached graph or on any persistence capable object?
>> Regards,
>> Jörg
>>
>
>
> -- 
> Michael Bouschen        Tech@Spree Engineering GmbH
> mailto:mbo.tech@spree.de    http://www.tech.spree.de/
> Tel.:++49/30/235 520-33        Buelowstr. 66
> Fax.:++49/30/2175 2012        D-10783 Berlin
>


Mime
View raw message