OPENJPA-1155 Committing code contributed by Dianne Richards. This update ensures that all entities, especially those loaded during detachment get cascaded during detach.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@791568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeremy Bauer 2009-07-06 19:06:19 +00:00
parent 10bd4e70de
commit 9ee5383721
1 changed files with 11 additions and 2 deletions

View File

@ -3321,8 +3321,17 @@ public class BrokerImpl
if (call == null)
call = _call;
new DetachManager(this, true, call).detachAll
(new ManagedObjectCollection(states));
// Make sure ALL entities are detached, even new ones that are loaded
// during the detach processing
boolean origCascade = _compat.getCascadeWithDetach();
_compat.setCascadeWithDetach(true);
try {
new DetachManager(this, true, call)
.detachAll(new ManagedObjectCollection(states));
}
finally {
_compat.setCascadeWithDetach(origCascade);
}
}
public Object attach(Object obj, boolean copyNew, OpCallbacks call) {