Hibernate 3.6.10 doesn't cascade delete through OneToMany JoinTable

前端 未结 2 1284
伪装坚强ぢ
伪装坚强ぢ 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)
    
    0 讨论(0)
  • 2021-01-14 09:28

    After further work with Hibernate finally I realise I wasn't implementing correctly equals and hashCode functions causing some troubles with Hibernate Generated Sequence on CRUD operations. The problem is described (and solved) in this great article (a must read, in my opinion)

    Best regards

    0 讨论(0)
提交回复
热议问题