code: public <T> List<Predicate> byExampleOnXToMany(ManagedType<T> mt, Root<T> mtPath, T mtValue, SearchParameters sp, CriteriaBuilder builder) {
          List<Predicate> predicates = newArrayList();
          for (PluralAttribute<? super T, ?, ?> pa : mt.getPluralAttributes()) {
              if (pa.getCollectionType() == PluralAttribute.CollectionType.LIST) {
                  List<?> values = (List<?>) jpaUtil.getValue(mtValue, mt.getAttribute(pa.getName()));
                  if (values != null && !values.isEmpty()) {
                      if (sp.getUseAndInXToMany()) {
                          if (values.size() > 3) {
                              log.warning("Please note that using AND restriction on an Many to Many relationship requires as many joins as values");
                          }
                          for (Object value : values) {
                              ListJoin<T, ?> join = mtPath.join(mt.getList(pa.getName()));
                              predicates.add(join.in(value));
                          }
                      } else {
                          ListJoin<T, ?> join = mtPath.join(mt.getList(pa.getName()));
                          predicates.add(join.in(values));
                      }
                  }
              }
          }
          return predicates;
      }
docs: /*
  Construct a join predicate on collection (eg many to many, List)