public <T extends Object> void removeEntity(final EntityManager em,
final Class<T> entityClass, final T detached) throws Exception {
//em.remove(detached);
if (detached instanceof IEntity) {
final IEntity ientity = (IEntity) detached;
final long id = ientity.getId();
this.removeDetachedEntity(em, entityClass, id);
}
}