@RequiresSession
  public List<AlertGroupEntity> findGroupsByDefinition(
      AlertDefinitionEntity definitionEntity) {

    TypedQuery<AlertGroupEntity> query = entityManagerProvider.get().createNamedQuery(
        "AlertGroupEntity.findByAssociatedDefinition", AlertGroupEntity.class);

    query.setParameter("alertDefinition", definitionEntity);
    query.setHint(QueryHints.REFRESH, HintValues.TRUE);

    return daoUtils.selectList(query);
  }
Gets all of the {@link AlertGroupEntity} instances that include the
specified alert definition. Service default groups will also be returned.

@param definitionEntity
         the definition that the group must include (not {@code null}).
@return all alert groups that have an association with the specified
        definition and the definition's service default group or empty list
        if none exist (never {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java