In my application, a hibernate operation goes like this. The application updates a parent entity with new values from the request and deletes all the existing (previously insert
It worked for me.
Instead of setting the new child entities to my parent object, I have used addAll method to add the new child entities.
parent.getChildren().clear();
parent.getChildren().addAll(newChildrenList);
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY,
cascade = CascadeType.ALL, orphanRemoval = true)
public Set getChildren() {
return this.children;
}