It looks like it is due to a Cascading issue.
My definition of the relation between childs and parents is the following:
----------------------
relation in child class
---
@ManyToOne(fetch = FetchType.LAZY, targetEntity = Parent.class)
@JoinColumn(name = "parent_id", nullable = false, referencedColumnName="id")
@NotNull
public Parent getParent() {
return this.parent;
}
public void setParent(Parent Parent) {
this.parent = parent;
}
---------------------
relation in parent class
----
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, mappedBy = "parent")
public Set<Child> getChilds() {
return this.childs;
}
public void setChilds(Set<Child> childs) {
this.childs= childs;
}
--------------------
The parent is allready saved in the database.
When I try to merge the child, I have the above Exception.
The childs is merged with a parent entity object containing the same id as the parent saved in database.
Has someone any clue?
I'm dealing with this problem this far too long please help!
Thanks
J.
|