public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Tag tag;
try {
tag = em.getReference(Tag.class, id);
tag.getId();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The tag with id " + id + " no longer exists.", enfe);
}
List<String> illegalOrphanMessages = null;
List<Coursetag> coursetagListOrphanCheck = tag.getCoursetagList();
for (Coursetag coursetagListOrphanCheckCoursetag : coursetagListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Tag (" + tag + ") cannot be destroyed since the Coursetag " + coursetagListOrphanCheckCoursetag + " in its coursetagList field has a non-nullable tagId field.");
}
List<Tagcorrelations> tagcorrelationsListOrphanCheck = tag.getTagcorrelationsList();
for (Tagcorrelations tagcorrelationsListOrphanCheckTagcorrelations : tagcorrelationsListOrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Tag (" + tag + ") cannot be destroyed since the Tagcorrelations " + tagcorrelationsListOrphanCheckTagcorrelations + " in its tagcorrelationsList field has a non-nullable referencedTagId field.");
}
List<Tagcorrelations> tagcorrelationsList1OrphanCheck = tag.getTagcorrelationsList1();
for (Tagcorrelations tagcorrelationsList1OrphanCheckTagcorrelations : tagcorrelationsList1OrphanCheck) {
if (illegalOrphanMessages == null) {
illegalOrphanMessages = new ArrayList<String>();
}
illegalOrphanMessages.add("This Tag (" + tag + ") cannot be destroyed since the Tagcorrelations " + tagcorrelationsList1OrphanCheckTagcorrelations + " in its tagcorrelationsList1 field has a non-nullable mainTagId field.");