HHH-18503 Register root table name usage for persisters with physical discriminators
This commit is contained in:
parent
ecf4c29a60
commit
67269a6137
|
@ -5810,8 +5810,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
private ModelPart getIdentifierModelPart(String name, EntityMappingType treatTargetType) {
|
||||
final EntityIdentifierMapping identifierMapping = getIdentifierMappingForJoin();
|
||||
if ( identifierMapping instanceof NonAggregatedIdentifierMapping ) {
|
||||
NonAggregatedIdentifierMapping mapping = (NonAggregatedIdentifierMapping) identifierMapping;
|
||||
if ( identifierMapping instanceof final NonAggregatedIdentifierMapping mapping ) {
|
||||
final ModelPart subPart = mapping.findSubPart( name, treatTargetType );
|
||||
if ( subPart != null ) {
|
||||
return subPart;
|
||||
|
|
|
@ -3022,10 +3022,20 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
parentType.getRootEntityDescriptor().getEntityName()
|
||||
);
|
||||
}
|
||||
final EntityDiscriminatorMapping discriminator = parentType.getDiscriminatorMapping();
|
||||
final String entityName;
|
||||
if ( discriminator != null && discriminator.hasPhysicalColumn() && !parentType.getSubMappingTypes().isEmpty() ) {
|
||||
// This is needed to preserve optimization for joined + discriminator inheritance
|
||||
// see JoinedSubclassEntityPersister#getIdentifierMappingForJoin
|
||||
entityName = parentType.getRootEntityDescriptor().getEntityName();
|
||||
}
|
||||
else {
|
||||
entityName = parentType.getEntityName();
|
||||
}
|
||||
registerEntityNameUsage(
|
||||
tableGroup,
|
||||
EntityNameUse.EXPRESSION,
|
||||
parentType.getEntityName()
|
||||
entityName
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue