/**
   * Internal method that handles prefetching of to-many relationships.<br>
   * // TBD This is a workaround to what looks like a bug in WO 5.1 & WO 5.2. Remove as soon as it's
   * no longer needed
   *
   * <p>The problem is that even refreshing fetches don't refresh the to-many relationships they
   * prefetch.
   */
  public void _followToManyRelationshipWithFetchSpecification(
      EORelationship relationship,
      EOFetchSpecification fetchspecification,
      NSArray objects,
      EOEditingContext editingcontext) {
    int count = objects.count();

    for (int i = 0; i < count; i++) {
      EOEnterpriseObject object = (EOEnterpriseObject) objects.objectAtIndex(i);
      EOGlobalID sourceGlobalID = editingcontext.globalIDForObject(object);
      String relationshipName = relationship.name();

      if (!object.isFault()) {
        EOFaulting toManyArray = (EOFaulting) object.storedValueForKey(relationshipName);

        if (!toManyArray.isFault()) {
          EOFaulting tmpToManyArray =
              (EOFaulting)
                  arrayFaultWithSourceGlobalID(sourceGlobalID, relationshipName, editingcontext);

          // Turn the existing array back into a fault by assigning it
          // the fault handler of the newly created fault
          toManyArray.turnIntoFault(tmpToManyArray.faultHandler());
        }
      }
    }

    super._followToManyRelationshipWithFetchSpecification(
        relationship, fetchspecification, objects, editingcontext);
  }