Home » Support » Forum » Removing an element from an @OneToMany doesn't work

Removing an element from an @OneToMany doesn't work


Hello. I have a Parent and Child entities.

// in the parent

@OneToMany(mappedBy = "parent", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private List<Child> children;

// in the child

private Parent parent;

Somewhere I do this:


Manager.merge is just


But the element isn't removed. Should I remove the children entity too? It works using EntityManagerFactory.


You should update both sides, i.e. set null in the child's parent field.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login