|
Hi, I just ran into this "bug":
@Entity
public class AppHolder {
[...]
@ManyToOne(optional = false)
@OnDelete(action = OnDeleteAction.CASCADE)
public AppHolder getParent() {
return parent;
}
[...]
In hibernate deleting a self referencing AppHolder fails because hibernate sets parent to null which violates the not-null-constraint.
In plain sql there is no need to set parent to null because of the on-delete-cascade-constraint (without this constraint deleting a self referencing row is impossible).
Only solution in hibernate right now is to write "optional = true" - but i don't want to have it optional... 
What do you think?
Thanks in advance, Burkhard
|