HHH-10352 - Fix HBM2DDL does not use described name for foreign key in join inheritance

(cherry picked from commit 2ea122aedd)
This commit is contained in:
Andrea Boriero 2016-06-07 13:18:26 +01:00 committed by Gail Badner
parent dc0f99c4f4
commit e9e7a703e7
1 changed files with 7 additions and 0 deletions

View File

@ -653,6 +653,13 @@ public final class AnnotationBinder {
if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
key.setForeignKeyName( fk.name() );
}
else {
final PrimaryKeyJoinColumn pkJoinColumn = clazzToProcess.getAnnotation( PrimaryKeyJoinColumn.class );
if ( pkJoinColumn != null && pkJoinColumn.foreignKey() != null
&& !StringHelper.isEmpty( pkJoinColumn.foreignKey().name() ) ) {
key.setForeignKeyName( pkJoinColumn.foreignKey().name() );
}
}
if ( onDeleteAnn != null ) {
key.setCascadeDeleteEnabled( OnDeleteAction.CASCADE.equals( onDeleteAnn.action() ) );
}