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(
27472747 manyToOne .setReferencedPropertyName ( referencedPropertyName );
27482748 metadataCollector .addUniquePropertyReference ( targetEntity .getEntityName (), referencedPropertyName );
27492749 }
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 () );
27502752 manyToOne .setReferenceToPrimaryKey ( referencedPropertyName == null );
27512753 value .createForeignKey ();
27522754 }
Original file line number Diff line number Diff line change @@ -88,5 +88,8 @@ static class A {
8888 static class B {
8989 @ Id
9090 long id ;
91+ @ ManyToMany (mappedBy = "bs" )
92+ @ OnDelete (action = OnDeleteAction .CASCADE )
93+ Set <A > as = new HashSet <>();
9194 }
9295}
You can’t perform that action at this time.
0 commit comments