Hibernate 3.6.10 doesn't cascade delete through OneToMany JoinTable

前端 未结 2 1285
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 09:08

I\'ve been messing with this and googling it for about 4 days and I\'m getting crazy about how Hibernate annotations work with JPA annotations. I have two very simple entiti

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-14 09:27

    This looks very similar to

    http://www.mkyong.com/hibernate/cascade-jpa-hibernate-annotation-common-mistake/

    You are mixing JPA and hibernate annotations. I would stick with one (preferably JPA, but the blog posts sticks with hibernate) and had the relationship this way:

    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
    

提交回复
热议问题