private List<Integer> findAllAlertHistoryIdsBeforeDate(Long clusterId, long  beforeDateMillis) {

    EntityManager entityManager = m_entityManagerProvider.get();
    TypedQuery<Integer> alertHistoryQuery =
      entityManager.createNamedQuery("AlertHistoryEntity.findAllIdsInClusterBeforeDate", Integer.class);

    alertHistoryQuery.setParameter("clusterId", clusterId);
    alertHistoryQuery.setParameter("beforeDate", beforeDateMillis);

    return m_daoUtils.selectList(alertHistoryQuery);
  }
Find all @AlertHistoryEntity with date before provided date.
@param clusterId cluster id
@param beforeDateMillis timestamp in millis
@return List<Integer> ids
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java