diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java index e4160d9da9..1cc94e09e8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java @@ -1725,6 +1725,9 @@ public class ToOneAttributeMapping } private boolean isSelectByUniqueKey(ForeignKeyDescriptor.Nature side) { + if ( referencedPropertyName == null ) { + return false; + } if ( side == ForeignKeyDescriptor.Nature.KEY ) { // case 1.2 return !foreignKeyDescriptor.getNavigableRole()