EOGlobalID gid = ec.globalIDForObject(eo);
database.recordSnapshotForSourceGlobalID(null, gid, relationshipName);
Object o = eo.storedValueForKey(relationshipName);
boolean needRefresh = false;
if(o instanceof EOFaulting) {
EOFaulting toManyArray = (EOFaulting)o;
if (!toManyArray.isFault()) {
EOFaulting tmpToManyArray = (EOFaulting)((EOObjectStoreCoordinator)ec.rootObjectStore()).arrayFaultWithSourceGlobalID(gid, relationshipName, ec);
toManyArray.turnIntoFault(tmpToManyArray.faultHandler());
needRefresh = true;
}
} else {
EOFaulting tmpToManyArray = (EOFaulting)((EOObjectStoreCoordinator)ec.rootObjectStore()).arrayFaultWithSourceGlobalID(gid, relationshipName, ec);
eo.takeStoredValueForKey(tmpToManyArray, relationshipName);
needRefresh = true;
}
if(needRefresh && (eo instanceof ERXEnterpriseObject)) {
((ERXEnterpriseObject)eo).flushCaches();