code: private void addEntityGraphToFindMethodQueryHints(
        EntityGraphBean entityGraphCandidate, MethodInvocation invocation) {
      LOG.trace("Trying to push the EntityGraph candidate to the query hints find method");
  
      Map<String, Object> queryProperties = null;
      int index = 0;
      for (Object argument : invocation.getArguments()) {
        if (argument instanceof Map) {
          queryProperties = (Map) argument;
          break;
        }
        index++;
      }
      if (queryProperties == null) {
        LOG.trace("No query hints passed to the find method.");
        return;
      }
      if (!entityGraphCandidate.isPrimary() && QueryHintsUtils.containsEntityGraph(queryProperties)) {
        LOG.trace(
            "The query hints passed with the find method already hold an entity graph. Overriding aborted because the candidate EntityGraph is optional.");
        return;
      }
  
      queryProperties = new HashMap<String, Object>(queryProperties);
      QueryHintsUtils.removeEntityGraphs(queryProperties);
      queryProperties.putAll(
          QueryHintsUtils.buildQueryHints(
              (EntityManager) invocation.getThis(), entityGraphCandidate));
      invocation.getArguments()[index] = queryProperties;
    }
docs: Push the current entity graph to the find method query hints.
  
  @param entityGraphCandidate The EntityGraph to set
  @param invocation The invocation of the find method