HHH-10396 - Fix In a @OneToMany association with @JoinColum the @ForeignKey is not taken into consideration when generating the association database schema
This commit is contained in:
parent
14c97f0b5b
commit
cb0729b59f
|
@ -1097,7 +1097,6 @@ public abstract class CollectionBinder {
|
|||
key.setUpdateable( joinColumns.length == 0 || joinColumns[0].isUpdatable() );
|
||||
key.setCascadeDeleteEnabled( cascadeDeleteEnabled );
|
||||
collValue.setKey( key );
|
||||
|
||||
if ( property != null ) {
|
||||
final ForeignKey fk = property.getAnnotation( ForeignKey.class );
|
||||
if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
|
||||
|
@ -1124,6 +1123,17 @@ public abstract class CollectionBinder {
|
|||
|
||||
}
|
||||
}
|
||||
else {
|
||||
final JoinColumn joinColumnAnn = property.getAnnotation( JoinColumn.class );
|
||||
if ( joinColumnAnn != null ) {
|
||||
if ( joinColumnAnn.foreignKey().value() == ConstraintMode.NO_CONSTRAINT ) {
|
||||
key.setForeignKeyName( "none" );
|
||||
}
|
||||
else {
|
||||
key.setForeignKeyName( StringHelper.nullIfEmpty( joinColumnAnn.foreignKey().name() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue