Hibernate inserts duplicates into a @OneToMany collection

前端 未结 5 1640
野性不改
野性不改 2020-12-01 20:52

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         


        
5条回答
  •  无人及你
    2020-12-01 21:33

    Managed this by just calling the empty() method. For this scenario,

    parent.getChildren().isEmpty()

    before

    parent.getChildren().add(child);
    

提交回复
热议问题