I have a OneToMany relationship defined like this:
@Entity
Parent {
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY, cascade = {
CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.MERGE})
private List<Child> childList;
// ...
@Version
private int version;
}
@Entity
Child {
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "PARENT_ID")
private Parent parent;
// ...
@Version
private int version;
}
Now when I change ONE of the child elements and do a merge by executing
em.merge(parent), the version of ALL children is incremented by one! I
expected that the version of the changed child is incremented only. Is this
a bug? I could not find anything about this behaviour in the
documentation...
--
View this message in context:
http://openjpa.208410.n2.nabble.com/Version-of-all-children-is-incremented-in-OneToMany-when-merging-parent-entity-tp6645128p6645128.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.