code: protected <OTHER, X extends Comparable<? super X>> Specification<ENTITY> buildReferringEntitySpecification(final RangeFilter<X> filter,
                                                                                                                 final SetAttribute<ENTITY, OTHER> reference,
                                                                                                                 final SingularAttribute<OTHER, X> valueField) {
          return buildReferringEntitySpecification(filter, root -> root.join(reference), entity -> entity.get(valueField));
      }
docs: Helper function to return a specification for filtering on one-to-many or many-to-many reference. Where equality, less
  than, greater than and less-than-or-equal-to and greater-than-or-equal-to and null/non-null conditions are
  supported. Usage:
  <pre>
  Specification&lt;Employee&gt; specByEmployeeId = buildReferringEntitySpecification(criteria.getEmployeId(),
  Project_.employees, Employee_.id);
  Specification&lt;Employee&gt; specByEmployeeName = buildReferringEntitySpecification(criteria.getEmployeName(),
  Project_.project, Project_.name);
  </pre>
  
  @param filter     the filter object which contains a value, which needs to match or a flag if emptiness is
  checked.
  @param reference  the attribute of the static metamodel for the referring entity.
  @param valueField the attribute of the static metamodel of the referred entity, where the equality should be
  checked.
  @param <OTHER>    The type of the referenced entity.
  @param <X>        The type of the attribute which is filtered.
  @return a Specification