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

--
__________________________________________________________
Dipl.-Inf. Jörg von Frantzius  |            artnology GmbH
                              |                Milastr. 4
Tel +49 (0)30 4435 099 26      |              10437 Berlin
Fax +49 (0)30 4435 099 99      |  http://www.artnology.com
_______________________________|__________________________

Reply via email to