Duplicates in OneToMany annotated List
问题 I'm working on a Java project using JPA 2 + Hibernate 4.2.6 and I'm getting a strange behaviour. In my model I have two related entites: Question and Answer @Entity public class Question { // ... @OneToMany(mappedBy = "question", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set<Answer> answers; // ... } @Entity public class Answer { // ... @ManyToOne(optional = false) @JoinColumn(name = "question_id", nullable = false) private Question question; // ... } This works perfectly: