mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
HHH-17755 make @MapsId work correctly with @IdClass
the @Id property was not getting populated
This commit is contained in:
parent
8215a28fcc
commit
78cd0175cc
@ -887,14 +887,16 @@ static PropertyData getPropertyOverriddenByMapperOrMapsId(
|
||||
.toXClass( propertyHolder.getPersistentClass().getMappedClass() );
|
||||
final InFlightMetadataCollector metadataCollector = buildingContext.getMetadataCollector();
|
||||
if ( propertyHolder.isInIdClass() ) {
|
||||
final PropertyData propertyData = metadataCollector.getPropertyAnnotatedWithIdAndToOne( mappedClass, propertyName );
|
||||
return propertyData == null && buildingContext.getBuildingOptions().isSpecjProprietarySyntaxEnabled()
|
||||
? metadataCollector.getPropertyAnnotatedWithMapsId( mappedClass, propertyName )
|
||||
: propertyData;
|
||||
}
|
||||
else {
|
||||
return metadataCollector.getPropertyAnnotatedWithMapsId( mappedClass, isId ? "" : propertyName );
|
||||
final PropertyData data = metadataCollector.getPropertyAnnotatedWithIdAndToOne( mappedClass, propertyName );
|
||||
if ( data != null ) {
|
||||
return data;
|
||||
}
|
||||
// TODO: is this branch even necessary?
|
||||
else if ( buildingContext.getBuildingOptions().isSpecjProprietarySyntaxEnabled() ) {
|
||||
return metadataCollector.getPropertyAnnotatedWithMapsId( mappedClass, propertyName );
|
||||
}
|
||||
}
|
||||
return metadataCollector.getPropertyAnnotatedWithMapsId( mappedClass, isId ? "" : propertyName );
|
||||
}
|
||||
|
||||
public static Map<String,String> toAliasTableMap(SqlFragmentAlias[] aliases){
|
||||
|
Loading…
x
Reference in New Issue
Block a user