diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java index c431db0a1c..8274d12d31 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/BinderHelper.java @@ -430,7 +430,16 @@ public class BinderHelper { for ( Property property : persistentClass.getProperties() ) { matchColumnsByProperty( property, columnsToProperty ); } - matchColumnsByProperty( persistentClass.getIdentifierProperty(), columnsToProperty ); + if ( persistentClass.hasIdentifierProperty() ) { + matchColumnsByProperty( persistentClass.getIdentifierProperty(), columnsToProperty ); + } + else { + // special case for entities with multiple @Id properties + Component key = persistentClass.getIdentifierMapper(); + for ( Property p : key.getProperties() ) { + matchColumnsByProperty( p, columnsToProperty ); + } + } } else { for ( Property property : ((Join) columnOwner).getProperties() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java index 6534d3f18a..9eea3516f1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java @@ -52,7 +52,8 @@ public class EntityTypeImpl persistentClass.getEntityName(), javaType, superType, - persistentClass.getDeclaredIdentifierMapper() != null || ( superType != null && superType.hasIdClass() ), + persistentClass.getDeclaredIdentifierMapper() != null + || superType != null && superType.hasIdClass(), persistentClass.hasIdentifierProperty(), persistentClass.isVersioned(), jpaMetamodel