Save child objects automatically using JPA Hibernate

前端 未结 7 702
南方客
南方客 2020-11-27 13:13

I have a one-to-many relation between Parent and Child table. In the parent object I have a

List setChildren(List childs)
         


        
7条回答
  •  一向
    一向 (楼主)
    2020-11-27 13:58

    In short set cascade type to all , will do a job; For an example in your model. Add Code like this . @OneToMany(mappedBy = "receipt", cascade=CascadeType.ALL) private List saleSet;

提交回复
热议问题