@RequiresSession
  public List<HostRoleCommandEntity> findByRequestIdAndStatuses(Long requestId, Collection<HostRoleStatus> statuses) {
    TypedQuery<HostRoleCommandEntity> query = entityManagerProvider.get().createNamedQuery(
        "HostRoleCommandEntity.findByRequestIdAndStatuses", HostRoleCommandEntity.class);
    query.setParameter("requestId", requestId);
    query.setParameter("statuses", statuses);
    List<HostRoleCommandEntity> results = query.getResultList();
    return results;
  }
Retrieves minimal host role command columns which are required to calculate stare state.
@param taskIds collection of host role commands to process.
@return minimized host role command entities.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java