Search in sources :

Example 1 with DiscriminatorPathInterpretation

use of org.hibernate.query.sqm.sql.internal.DiscriminatorPathInterpretation in project hibernate-orm by hibernate.

the class DiscriminatorSqmPath method interpret.

@Override
public SqmPathInterpretation<?> interpret(SqlAstCreationState sqlAstCreationState, SemanticQueryWalker sqmWalker, boolean jpaQueryComplianceEnabled) {
    assert entityDescriptor.hasSubclasses();
    final TableGroup tableGroup = sqlAstCreationState.getFromClauseAccess().getTableGroup(getNavigablePath().getParent());
    final ModelPartContainer modelPart = tableGroup.getModelPart();
    final EntityMappingType entityMapping;
    if (modelPart instanceof EntityValuedModelPart) {
        entityMapping = ((EntityValuedModelPart) modelPart).getEntityMappingType();
    } else {
        entityMapping = (EntityMappingType) ((PluralAttributeMapping) modelPart).getElementDescriptor().getPartMappingType();
    }
    return new DiscriminatorPathInterpretation(getNavigablePath(), entityMapping, tableGroup, sqlAstCreationState);
}
Also used : TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) EntityValuedModelPart(org.hibernate.metamodel.mapping.EntityValuedModelPart) DiscriminatorPathInterpretation(org.hibernate.query.sqm.sql.internal.DiscriminatorPathInterpretation) ModelPartContainer(org.hibernate.metamodel.mapping.ModelPartContainer) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType)

Aggregations

EntityMappingType (org.hibernate.metamodel.mapping.EntityMappingType)1 EntityValuedModelPart (org.hibernate.metamodel.mapping.EntityValuedModelPart)1 ModelPartContainer (org.hibernate.metamodel.mapping.ModelPartContainer)1 DiscriminatorPathInterpretation (org.hibernate.query.sqm.sql.internal.DiscriminatorPathInterpretation)1 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)1