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
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)
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