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 [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] http://www.tech.spree.de/
Tel.:++49/30/235 520-33 Buelowstr. 66
Fax.:++49/30/2175 2012 D-10783 Berlin