Hy all
I was wondering if anybody could brief me on the limitation of the DELETE_ORPHAN annotation in regards of inheritance.
In short, I've got a super class A with a oneToMany relationship to a class B (which has a bidirectional relationship back to A). The A to B relationship has the following annotations:
Code:
@OneToMany(mappedBy = "myA", cascade = CascadeType.ALL)
@Cascade({ org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
private Set<B> myBs = new HashSet<B>();
I also got a sub classe C which inherits from A.
When I try to delete a persisted instance of C, I get the following error:
org.hibernate.AssertionFailure: Unable to determine collection owner identifier for orphan-delete processingI tried a whole lot of things before actually moving my relationship down into C and that did the trick.
So I was just wondering if that (the fact that the DELETE_ORPHAN does not 'span down' to sub classes) is a wanted behavior or a bug (or maybe I've just missed something)
Thanks
PS: I'm using Hibernate 3.3.1 with JPA