I have the following entities with @OneToOne relation:
@Entity public static class EntityChild extends BaseEntity {
Now the following test fails:
EntityParent parent = new EntityParent(); em.persist(parent); em.flush(); EntityChild child = new EntityChild(); parent.setChild(child); em.persist(parent); em.flush(); em.remove(parent.getChild()); em.flush();
It throws an exception on the last line using flush (). An exception is javax.persistence.EntityNotFoundException: deleted entity passed to persist: [my.package.EntityChild#<null>]
Why can't I delete this object?
source share