public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    // R9600
    Query_c relInst39590 =
        (Query_c) baseRoot.getInstanceList(Query_c.class).get(new Object[] {m_id});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst39590 == null) {
      relInst39590 =
          (Query_c)
              Ooaofooa.getDefaultInstance().getInstanceList(Query_c.class).get(new Object[] {m_id});
    }
    if (relInst39590 == null && searchAllRoots && !baseRoot.isCompareRoot()) {
      Ooaofooa[] roots = Ooaofooa.getInstances();
      for (int i = 0; i < roots.length; i++) {
        if (roots[i].isCompareRoot()) {
          // never use elements from any compare root
          continue;
        }
        relInst39590 = (Query_c) roots[i].getInstanceList(Query_c.class).get(new Object[] {m_id});
        if (relInst39590 != null) break;
      }
    }
    // synchronized
    if (relInst39590 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst39590) && !isProxy())) {
        relInst39590.relateAcrossR9600To(this, notifyChanges);
      }
    }
  }