How do I delete orphan entities using hibernate and JPA on a many-to-many relationship?

后端 未结 4 1640
猫巷女王i
猫巷女王i 2020-12-30 22:54

I want to delete orphan entities using hibernate and JPA on a many-to-many relationship but all that I found was this attribute the attribute. org.hibernate.annotations.Casc

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 23:13

    try this:

    @ManyToMany(cascade = CascadeType.ALL, orphanRemoval=true, fetch = FetchType.LAZY, mappedBy = "yourObject")
    

提交回复
热议问题