@RequiresSession
  public List<Long> findAllRequestIds(int limit, boolean ascending) {
    String sort = "ASC";
    if (!ascending) {
      sort = "DESC";
    }

    String sql = MessageFormat.format(REQUEST_IDS_SORTED_SQL, sort);
    TypedQuery<Long> query = entityManagerProvider.get().createQuery(sql,
        Long.class);

    query.setMaxResults(limit);

    return daoUtils.selectList(query);
  }
Given a collection of request ids, load the corresponding entities
@param requestIds  the collection of request ids
@param refreshHint {@code true} to hint JPA that the list should be refreshed
@return the list entities. An empty list if the requestIds are not provided
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java