@RequiresSession
  public List<HostRoleCommandEntity> findAll(Request request, Predicate predicate) {
    EntityManager entityManager = entityManagerProvider.get();

    // convert the Ambari predicate into a JPA predicate
    HostRoleCommandPredicateVisitor visitor = new HostRoleCommandPredicateVisitor();
    PredicateHelper.visit(predicate, visitor);

    CriteriaQuery<HostRoleCommandEntity> query = visitor.getCriteriaQuery();
    jakarta.persistence.criteria.Predicate jpaPredicate = visitor.getJpaPredicate();

    if (null != jpaPredicate) {
      query.where(jpaPredicate);
    }

    // sorting
    SortRequest sortRequest = request.getSortRequest();
    if (null != sortRequest) {
      JpaSortBuilder<HostRoleCommandEntity> sortBuilder = new JpaSortBuilder<>();
      List<Order> sortOrders = sortBuilder.buildSortOrders(sortRequest, visitor);
      query.orderBy(sortOrders);
    }

    TypedQuery<HostRoleCommandEntity> typedQuery = entityManager.createQuery(query);

    // pagination
    PageRequest pagination = request.getPageRequest();
    if (null != pagination) {
      typedQuery.setFirstResult(pagination.getOffset());
      typedQuery.setMaxResults(pagination.getPageSize());
    }

    return daoUtils.selectList(typedQuery);
  }
Finds all {@link HostRoleCommandEntity} that match the provided predicate.
This method will make JPA do the heavy lifting of providing a slice of the
result set.

@param request
@return
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java