This content has been marked as final.
Show 2 replies
-
1. Re: In a OneToMany relation, invoking clear() on the collect
petergoldstein Mar 17, 2006 1:45 PM (in response to alfonsotames)This is the behavior dictated by the EJB spec. If you want the orphaned items to be deleted, you need to add an additional Hibernate-specific annotation. Add this:
@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN } )
to the annotations defining the association on the @OneToMany side and you should see the orphaned objects deleted from the database.
--Peter -
2. Re: In a OneToMany relation, invoking clear() on the collect
alfonsotames Mar 17, 2006 1:58 PM (in response to alfonsotames)It works !!!!
Finally it is removing the records instead of setting them to NULL.
I have the EJB3 spec and the docs from JBoss but didn't find this.
Thanks a lot.
Alfonso