mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 12:44:49 +00:00
HHH-17727 Avoid name uses for subtypes when selecting discriminator only
This commit is contained in:
parent
dfb56c2f36
commit
34374c0c70
@ -3176,15 +3176,15 @@ protected void registerTypeUsage(TableGroup tableGroup) {
|
||||
// The AND junction allows to create an intersection of entity name lists of all sub-predicates
|
||||
final EntityMappingType mappingType = (EntityMappingType) tableGroup.getModelPart().getPartMappingType();
|
||||
final AbstractEntityPersister persister = (AbstractEntityPersister) mappingType.getEntityPersister();
|
||||
// Avoid resolving subclass tables for persisters with physical discriminators as we won't need them
|
||||
if ( persister.getDiscriminatorMapping().hasPhysicalColumn() ) {
|
||||
return;
|
||||
}
|
||||
if ( getCurrentClauseStack().getCurrent() != Clause.WHERE && getCurrentClauseStack().getCurrent() != Clause.HAVING ) {
|
||||
// Where and having clauses are handled specially with EntityNameUse.FILTER and pruning
|
||||
registerEntityNameUsage( tableGroup, EntityNameUse.PROJECTION, persister.getEntityName(), true );
|
||||
}
|
||||
else {
|
||||
// Avoid resolving subclass tables for persisters with physical discriminators as we won't need them
|
||||
if ( persister.getDiscriminatorMapping().hasPhysicalColumn() ) {
|
||||
return;
|
||||
}
|
||||
final int subclassTableSpan = persister.getSubclassTableSpan();
|
||||
for ( int i = 0; i < subclassTableSpan; i++ ) {
|
||||
tableGroup.resolveTableReference( null, persister.getSubclassTableName( i ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user