public void destroy(FactionstatPK id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Factionstat factionstat;
try {
factionstat = em.getReference(Factionstat.class, id);
factionstat.getFactionstatPK();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The factionstat with id " + id + " no longer exists.", enfe);
}
Faction faction = factionstat.getFaction();
if (faction != null) {
faction.getFactionstatCollection().remove(factionstat);
faction = em.merge(faction);
}
Account account = factionstat.getAccount();
if (account != null) {
account.getFactionstatCollection().remove(factionstat);
account = em.merge(account);
}
em.remove(factionstat);