code: static void filterUnwantedReferences(List<JpaRef> result, Collection<BeanId> query) {
          ListIterator<JpaRef> it = result.listIterator();
          while (it.hasNext()) {
              // remove reference from result that was not part of the query
              BeanId found = it.next().getSource();
              if (!query.contains(found)) {
                  it.remove();
              }
          }
      }
docs: Beans with different schemaName may have same instance id.
  
  The IN search query is greedy, finding instances that
  match any combination of instance id and schemaName. Hence,
  the query may find references belonging to wrong schema
  so filter those out.