public void destroy(WeaponsetPK id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Weaponset weaponset;
try {
weaponset = em.getReference(Weaponset.class, id);
weaponset.getWeaponsetPK();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The weaponset with id " + id + " no longer exists.", enfe);
}
Weapon weapons = weaponset.getWeapons();
if (weapons != null) {
weapons.getWeaponsetCollection().remove(weaponset);
weapons = em.merge(weapons);
}
Character character = weaponset.getCharacter();
if (character != null) {
character.getWeaponsetCollection().remove(weaponset);
character = em.merge(character);
}
em.remove(weaponset);