db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: Issue 135: Remove attachCopy from PersistenceManager
Date Wed, 02 Nov 2005 15:30:15 GMT
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.

Regards Michael

> 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