// We want to copy the group level AlertDefinitions, so fetch them with the relevant lazy fields, so we
// have everything we need when calling the copy constructor, minimizing
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterResourceGroupIds(resourceGroupId);
criteria.fetchGroupAlertDefinition(false);
criteria.fetchConditions(true);
criteria.fetchAlertNotifications(true);
// Apply paging when optionally fetching collections, to avoid duplicates. Hibernate seems to apply DISTINCT,
// which is what we want. Use a huge # because we want them all.
criteria.setPaging(0, Integer.MAX_VALUE);