NullPointerException when using join with subselect in hbm mapping

Description

When using a <join> with <subselect> in hbm configuration, a NullPointerException is thrown due to an empty table name:

Caused by: java.lang.NullPointerException
at org.hibernate.sql.Alias.toAliasString(Alias.java:38)
at org.hibernate.mapping.Join.createPrimaryKey(Join.java:95)
at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindSecondaryTable(ModelBinder.java:1819)
at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindAllEntityAttributes(ModelBinder.java:1114)
at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindRootEntity(ModelBinder.java:265)
at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:185)
at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Dirk Feufel

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.1.0
5.0.9
5.2.1

Priority

Blocker