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 a1b133381f
commit 312ef5600f
1 changed files with 7 additions and 0 deletions

View File

@ -655,6 +655,13 @@ public final class AnnotationBinder {
if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) { if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
key.setForeignKeyName( 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 ) { if ( onDeleteAnn != null ) {
key.setCascadeDeleteEnabled( OnDeleteAction.CASCADE.equals( onDeleteAnn.action() ) ); key.setCascadeDeleteEnabled( OnDeleteAction.CASCADE.equals( onDeleteAnn.action() ) );
} }