File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
main/java/org/hibernate/boot/model/internal
test/java/org/hibernate/orm/test/ondeletecascade Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -2747,6 +2747,8 @@ private void bindUnownedManyToManyInverseForeignKey(
2747
2747
manyToOne .setReferencedPropertyName ( referencedPropertyName );
2748
2748
metadataCollector .addUniquePropertyReference ( targetEntity .getEntityName (), referencedPropertyName );
2749
2749
}
2750
+ // Ensure that we copy over the delete action from the owner side before creating the foreign key
2751
+ manyToOne .setOnDeleteAction ( ( (SimpleValue ) ( (Collection ) property .getValue () ).getKey () ).getOnDeleteAction () );
2750
2752
manyToOne .setReferenceToPrimaryKey ( referencedPropertyName == null );
2751
2753
value .createForeignKey ();
2752
2754
}
Original file line number Diff line number Diff line change @@ -88,5 +88,8 @@ static class A {
88
88
static class B {
89
89
@ Id
90
90
long id ;
91
+ @ ManyToMany (mappedBy = "bs" )
92
+ @ OnDelete (action = OnDeleteAction .CASCADE )
93
+ Set <A > as = new HashSet <>();
91
94
}
92
95
}
You can’t perform that action at this time.
0 commit comments