@RequiresSession
  public List<AlertDefinitionEntity> findByService(long clusterId,
      String serviceName) {
    TypedQuery<AlertDefinitionEntity> query = entityManagerProvider.get().createNamedQuery(
        "AlertDefinitionEntity.findByService", AlertDefinitionEntity.class);

    query.setParameter("clusterId", clusterId);
    query.setParameter("serviceName", serviceName);

    return daoUtils.selectList(query);
  }
Gets all alert definitions for the given service in the specified cluster.

@param clusterId
         the ID of the cluster.
@param serviceName
         the name of the service.

@return all alert definitions for the service or empty list if none exist
        (never {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java