HHH-11502 - Fix NPE.
This commit is contained in:
parent
8d726a35b1
commit
e77d18c0d1
|
@ -4116,7 +4116,7 @@ public class ModelBinder {
|
||||||
// implicit naming. If we get here, we assume that there is only a single
|
// implicit naming. If we get here, we assume that there is only a single
|
||||||
// column making up the FK
|
// column making up the FK
|
||||||
|
|
||||||
final String referencedEntityAttributeName = manyToOneSource.getReferencedEntityAttributeName();
|
// final String referencedEntityAttributeName = manyToOneSource.getReferencedEntityAttributeName();
|
||||||
|
|
||||||
final PersistentClass referencedEntityBinding = mappingDocument.getMetadataCollector()
|
final PersistentClass referencedEntityBinding = mappingDocument.getMetadataCollector()
|
||||||
.getEntityBinding( referencedEntityName );
|
.getEntityBinding( referencedEntityName );
|
||||||
|
@ -4128,35 +4128,35 @@ public class ModelBinder {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final EntityNaming entityNaming = new EntityNamingSourceImpl( referencedEntityBinding );
|
// final EntityNaming entityNaming = new EntityNamingSourceImpl( referencedEntityBinding );
|
||||||
|
//
|
||||||
final Identifier referencedTableName;
|
// final Identifier referencedTableName;
|
||||||
final Identifier referencedColumnName;
|
// final Identifier referencedColumnName;
|
||||||
|
//
|
||||||
if ( referencedEntityAttributeName == null ) {
|
// if ( referencedEntityAttributeName == null ) {
|
||||||
referencedTableName = referencedEntityBinding.getTable().getNameIdentifier();
|
// referencedTableName = referencedEntityBinding.getTable().getNameIdentifier();
|
||||||
final Column referencedColumn = referencedEntityBinding.getTable()
|
// final Column referencedColumn = referencedEntityBinding.getTable()
|
||||||
.getPrimaryKey()
|
// .getPrimaryKey()
|
||||||
.getColumn( 0 );
|
// .getColumn( 0 );
|
||||||
referencedColumnName = mappingDocument.getMetadataCollector()
|
// referencedColumnName = mappingDocument.getMetadataCollector()
|
||||||
.getDatabase()
|
// .getDatabase()
|
||||||
.getJdbcEnvironment()
|
// .getJdbcEnvironment()
|
||||||
.getIdentifierHelper()
|
// .getIdentifierHelper()
|
||||||
.toIdentifier( referencedColumn.getQuotedName() );
|
// .toIdentifier( referencedColumn.getQuotedName() );
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
final Property referencedProperty = referencedEntityBinding.getReferencedProperty(
|
// final Property referencedProperty = referencedEntityBinding.getReferencedProperty(
|
||||||
referencedEntityAttributeName
|
// referencedEntityAttributeName
|
||||||
);
|
// );
|
||||||
final SimpleValue value = (SimpleValue) referencedProperty.getValue();
|
// final SimpleValue value = (SimpleValue) referencedProperty.getValue();
|
||||||
referencedTableName = value.getTable().getNameIdentifier();
|
// referencedTableName = value.getTable().getNameIdentifier();
|
||||||
final Column referencedColumn = (Column) value.getColumnIterator().next();
|
// final Column referencedColumn = (Column) value.getColumnIterator().next();
|
||||||
referencedColumnName = mappingDocument.getMetadataCollector()
|
// referencedColumnName = mappingDocument.getMetadataCollector()
|
||||||
.getDatabase()
|
// .getDatabase()
|
||||||
.getJdbcEnvironment()
|
// .getJdbcEnvironment()
|
||||||
.getIdentifierHelper()
|
// .getIdentifierHelper()
|
||||||
.toIdentifier( referencedColumn.getQuotedName() );
|
// .toIdentifier( referencedColumn.getQuotedName() );
|
||||||
}
|
// }
|
||||||
|
|
||||||
relationalObjectBinder.bindColumnsAndFormulas(
|
relationalObjectBinder.bindColumnsAndFormulas(
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
|
|
Loading…
Reference in New Issue