code: @SuppressWarnings("unchecked")
      public List<E> findAllWhereFieldEquals(String fieldName, Object fieldEntity,
                                             Criterion... criterion) {
  
          Class<?> fieldEntityType = null;
  
          if (fieldEntity != null) {
              fieldEntityType = fieldEntity.getClass();
          }
  
          final boolean isField = EntityUtil.isField(entityClass, fieldName, fieldEntityType, true);
  
          if (!isField) {
              String errorMsg = String.format(
                  "There is no field '%s' in the type '%s' that accepts instances of '%s'",
                  fieldName,
                  entityClass.getName(),
                  fieldEntityType.getName()
              );
              throw new IllegalArgumentException(errorMsg);
          }
  
          Criteria criteria = createDistinctRootEntityCriteria(criterion);
  
          if (fieldEntity == null) {
              criteria.add(Restrictions.isNull(fieldName));
          } else {
              criteria.add(Restrictions.eq(fieldName, fieldEntity));
          }
          criteria.setCacheable(this.useQueryCache);
  
          return (List<E>) criteria.list();
      }
docs: Returns a list of entity objects that have field named
  <code>fieldName</code>, which has an object <code>fieldEntity</code>
  as value.
  
  @param fieldName   The name of the field
  @param fieldEntity The element that should be set as value
  @param criterion   Additional criterions to apply (optional)
  @return The list of objects