Search in sources :

Example 26 with SqlExpressionResolver

use of org.hibernate.sql.ast.spi.SqlExpressionResolver in project hibernate-orm by hibernate.

the class Any method applySqlSelections.

@Override
public void applySqlSelections(DomainResultCreationState creationState) {
    final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
    final SqlExpressionResolver sqlExpressionResolver = sqlAstCreationState.getSqlExpressionResolver();
    sqlExpressionResolver.resolveSqlSelection(this, type.getJdbcMappings().get(0).getJavaTypeDescriptor(), sqlAstCreationState.getCreationContext().getMappingMetamodel().getTypeConfiguration());
}
Also used : SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState)

Example 27 with SqlExpressionResolver

use of org.hibernate.sql.ast.spi.SqlExpressionResolver in project hibernate-orm by hibernate.

the class CaseSimpleExpression method applySqlSelections.

@Override
public void applySqlSelections(DomainResultCreationState creationState) {
    final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
    final SqlExpressionResolver sqlExpressionResolver = sqlAstCreationState.getSqlExpressionResolver();
    sqlExpressionResolver.resolveSqlSelection(this, type.getJdbcMappings().get(0).getJavaTypeDescriptor(), sqlAstCreationState.getCreationContext().getMappingMetamodel().getTypeConfiguration());
}
Also used : SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState)

Example 28 with SqlExpressionResolver

use of org.hibernate.sql.ast.spi.SqlExpressionResolver in project hibernate-orm by hibernate.

the class Every method applySqlSelections.

@Override
public void applySqlSelections(DomainResultCreationState creationState) {
    final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
    final SqlExpressionResolver sqlExpressionResolver = sqlAstCreationState.getSqlExpressionResolver();
    sqlExpressionResolver.resolveSqlSelection(this, type.getJdbcMappings().get(0).getJavaTypeDescriptor(), sqlAstCreationState.getCreationContext().getMappingMetamodel().getTypeConfiguration());
}
Also used : SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState)

Example 29 with SqlExpressionResolver

use of org.hibernate.sql.ast.spi.SqlExpressionResolver in project hibernate-orm by hibernate.

the class Duration method applySqlSelections.

@Override
public void applySqlSelections(DomainResultCreationState creationState) {
    final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
    final SqlExpressionResolver sqlExpressionResolver = sqlAstCreationState.getSqlExpressionResolver();
    sqlExpressionResolver.resolveSqlSelection(this, type.getJdbcMapping().getJavaTypeDescriptor(), sqlAstCreationState.getCreationContext().getMappingMetamodel().getTypeConfiguration());
}
Also used : SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState)

Example 30 with SqlExpressionResolver

use of org.hibernate.sql.ast.spi.SqlExpressionResolver in project hibernate-orm by hibernate.

the class QuerySpec method createDomainResult.

@Override
public DomainResult createDomainResult(String resultVariable, DomainResultCreationState creationState) {
    TypeConfiguration typeConfiguration = creationState.getSqlAstCreationState().getCreationContext().getMappingMetamodel().getTypeConfiguration();
    final SqlExpressionResolver sqlExpressionResolver = creationState.getSqlAstCreationState().getSqlExpressionResolver();
    if (selectClause.getSqlSelections().size() == 1) {
        SqlSelection first = selectClause.getSqlSelections().get(0);
        JavaType descriptor = first.getExpressionType().getJdbcMappings().get(0).getJavaTypeDescriptor();
        final SqlSelection sqlSelection = sqlExpressionResolver.resolveSqlSelection(this, descriptor, typeConfiguration);
        return new BasicResult<>(sqlSelection.getValuesArrayPosition(), resultVariable, descriptor);
    } else {
        throw new UnsupportedOperationException("Domain result for non-scalar subquery shouldn't be created!");
    }
}
Also used : JavaType(org.hibernate.type.descriptor.java.JavaType) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection)

Aggregations

SqlExpressionResolver (org.hibernate.sql.ast.spi.SqlExpressionResolver)41 SqlAstCreationState (org.hibernate.sql.ast.spi.SqlAstCreationState)23 SqlSelection (org.hibernate.sql.ast.spi.SqlSelection)20 TableReference (org.hibernate.sql.ast.tree.from.TableReference)19 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)18 NavigablePath (org.hibernate.query.spi.NavigablePath)17 ColumnReference (org.hibernate.sql.ast.tree.expression.ColumnReference)17 DomainResultCreationState (org.hibernate.sql.results.graph.DomainResultCreationState)16 BasicResult (org.hibernate.sql.results.graph.basic.BasicResult)15 FetchTiming (org.hibernate.engine.FetchTiming)13 Fetch (org.hibernate.sql.results.graph.Fetch)13 FetchParent (org.hibernate.sql.results.graph.FetchParent)13 BiConsumer (java.util.function.BiConsumer)12 EntityMappingType (org.hibernate.metamodel.mapping.EntityMappingType)12 JdbcMapping (org.hibernate.metamodel.mapping.JdbcMapping)12 DomainResult (org.hibernate.sql.results.graph.DomainResult)12 JavaType (org.hibernate.type.descriptor.java.JavaType)12 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)11 FetchStyle (org.hibernate.engine.FetchStyle)10 SharedSessionContractImplementor (org.hibernate.engine.spi.SharedSessionContractImplementor)10