HI I have a PK that consists of an embeddable object.
It’s made out of two constraints
@ManyToOne
SpecificType1 spec;
@ManyToOne
SpecificType1 spec;
So basically a mapping table between two objects.
I’d like to cascade delete based on the object that implements this embeddable PK.
I added @Cascade({CascadeType.DELETE, CascadeType.DELETE_ORPHAN}) on SpecificType1, but it just won’t execute the cascade.
This cascade does not make sense.
You have many
Fooentities having the sameSpecificType1(ManyToOne). And you’re configuring Hibernate so that if you delete one of theFooinstances, it also deletes theSpecificType1. This would obviously leave all the otherFooentities with an association to an unexistingSpecificType1, which would break the foreign key constraint, and cause a rollback.