public void destroy(EquippedSkillPK id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
EquippedSkill equippedSkill;
try {
equippedSkill = em.getReference(EquippedSkill.class, id);
equippedSkill.getEquippedSkillPK();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The equippedSkill with id " + id + " no longer exists.", enfe);
}
Skill skill = equippedSkill.getSkill();
if (skill != null) {
skill.getEquippedSkillCollection().remove(equippedSkill);
skill = em.merge(skill);
}
Character character = equippedSkill.getCharacter();
if (character != null) {
character.getEquippedSkillCollection().remove(equippedSkill);
character = em.merge(character);
}
em.remove(equippedSkill);