code: @Transactional
      public List<E> find(E entity, SearchParameters sp) {
          if (sp.hasNamedQuery()) {
              return byNamedQueryUtil.findByNamedQuery(sp);
          }
          CriteriaBuilder builder = entityManager.getCriteriaBuilder();
          CriteriaQuery<E> criteriaQuery = builder.createQuery(type);
          if (sp.getDistinct()) {
              criteriaQuery.distinct(true);
          }
          Root<E> root = criteriaQuery.from(type);
  
          // predicate
          Predicate predicate = getPredicate(criteriaQuery, root, builder, entity, sp);
          if (predicate != null) {
              criteriaQuery = criteriaQuery.where(predicate);
          }
  
          // fetches
          fetches(sp, root);
  
          // order by
          criteriaQuery.orderBy(orderByUtil.buildJpaOrders(sp.getOrders(), root, builder, sp));
  
          TypedQuery<E> typedQuery = entityManager.createQuery(criteriaQuery);
          applyCacheHints(typedQuery, sp);
          jpaUtil.applyPagination(typedQuery, sp);
          List<E> entities = typedQuery.getResultList();
          log.fine("Returned " + entities.size() + " elements");
  
          return entities;
      }
docs: Find and load a list of E instance.
  
  @param entity a sample entity whose non-null properties may be used as search hints
  @param sp     carries additional search information
  @return the entities matching the search.