@RequiresSession
  public List<LastServiceCheckDTO> getLatestServiceChecksByRole(long clusterId) {
    TypedQuery<LastServiceCheckDTO> query = entityManagerProvider.get().createNamedQuery(
        "HostRoleCommandEntity.findLatestServiceChecksByRole", LastServiceCheckDTO.class);

    query.setParameter("clusterId", clusterId);
    query.setParameter("roleCommand", RoleCommand.SERVICE_CHECK);

    return daoUtils.selectList(query);
  }
Gets the most recently run service check grouped by the command's role
(which is the only way to identify the service it was for!?)

@param clusterId
         the ID of the cluster to get the service checks for.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java