HHH-13054 handle referencedColumnName to entities with multiple @Id properties

This commit is contained in:
Gavin King 2022-10-27 19:42:13 +02:00
parent 1f4c8f7b19
commit b6792bdb19
2 changed files with 12 additions and 2 deletions

View File

@ -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() ) {

View File

@ -52,7 +52,8 @@ public class EntityTypeImpl<J>
persistentClass.getEntityName(),
javaType,
superType,
persistentClass.getDeclaredIdentifierMapper() != null || ( superType != null && superType.hasIdClass() ),
persistentClass.getDeclaredIdentifierMapper() != null
|| superType != null && superType.hasIdClass(),
persistentClass.hasIdentifierProperty(),
persistentClass.isVersioned(),
jpaMetamodel