I have a question concerning Hibernate 3.6.7 and JPA 2.0.
Consider following entities (some getters and setters are omitted for brevity):
@Entity
pub
I fixed this problem by telling Hibernate not to add duplicates in my collection. In your case change the type of your children
field from List
to Set
and implement equals(Object obj)
and hashCode()
on the Child
class.
Obviously this will not be possible in every case, but if there is a sane way to identify that a Child
instance is unique then this solution can be relatively painless.