@PreRemove
  public void preRemove() {
    if (null == alertGroups || alertGroups.size() == 0) {
      return;
    }

    Iterator<AlertGroupEntity> iterator = alertGroups.iterator();
    while (iterator.hasNext()) {
      AlertGroupEntity group = iterator.next();
      iterator.remove();

      group.removeAlertDefinition(this);
    }
  }
Called before {@link EntityManager#remove(Object)} for this entity, removes
the non-owning relationship between definitions and groups.
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java