Package org.hibernate.query.sqm.internal
Class SqmUtil
- java.lang.Object
-
- org.hibernate.query.sqm.internal.SqmUtil
-
public class SqmUtil extends Object
Helper utilities for dealing with SQM
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JdbcParameterBindings
createJdbcParameterBindings(QueryParameterBindings domainParamBindings, DomainParameterXref domainParameterXref, Map<QueryParameterImplementor<?>,Map<SqmParameter<?>,List<JdbcParametersList>>> jdbcParamXref, MappingMetamodel domainModel, Function<NavigablePath,TableGroup> tableGroupLocator, SqmParameterMappingModelResolutionAccess mappingModelResolutionAccess, SharedSessionContractImplementor session)
static Bindable
determineParameterType(QueryParameterBinding<?> binding, QueryParameterImplementor<?> parameter, List<SqmParameter<?>> sqmParameters, SqmParameterMappingModelResolutionAccess mappingModelResolutionAccess, SessionFactoryImplementor sessionFactory)
static IllegalQueryOperationException
expectingNonSelect(SqmStatement<?> sqm, String hqlString)
static <T,A>
SqmAttributeJoin<T,A>findCompatibleFetchJoin(SqmFrom<?,T> sqmFrom, SqmPathSource<A> pathSource, SqmJoinType requestedJoinType)
static Map<QueryParameterImplementor<?>,Map<SqmParameter<?>,List<JdbcParametersList>>>
generateJdbcParamsXref(DomainParameterXref domainParameterXref, JdbcParameterBySqmParameterAccess jdbcParameterBySqmParameterAccess)
static ModelPartContainer
getTargetMappingIfNeeded(SqmPath<?> sqmPath, ModelPartContainer modelPartContainer, SqmToSqlAstConverter sqlAstCreationState)
Utility that returns the entity association target's mapping type if the specifiedsqmPath
should be dereferenced using the target table, i.e.static boolean
isFkOptimizationAllowed(SqmPath<?> sqmPath)
Utility that returnsfalse
when the providedsqmPath
is a join that cannot be dereferenced through the foreign key on the associated table, i.e.static boolean
isHqlTuple(SqmSelection<?> selection)
static boolean
isMutation(SqmStatement<?> sqm)
static boolean
isSelect(SqmStatement<?> sqm)
static boolean
isSelectionAssignableToResultType(SqmSelection<?> selection, Class<?> expectedResultType)
static SqmStatement.ParameterResolutions
resolveParameters(SqmStatement<?> statement)
static void
verifyIsNonSelectStatement(SqmStatement<?> sqm, String hqlString)
static void
verifyIsSelectStatement(SqmStatement<?> sqm, String hqlString)
-
-
-
Method Detail
-
isSelect
public static boolean isSelect(SqmStatement<?> sqm)
-
isMutation
public static boolean isMutation(SqmStatement<?> sqm)
-
verifyIsSelectStatement
public static void verifyIsSelectStatement(SqmStatement<?> sqm, String hqlString)
-
verifyIsNonSelectStatement
public static void verifyIsNonSelectStatement(SqmStatement<?> sqm, String hqlString)
-
expectingNonSelect
public static IllegalQueryOperationException expectingNonSelect(SqmStatement<?> sqm, String hqlString)
-
getTargetMappingIfNeeded
public static ModelPartContainer getTargetMappingIfNeeded(SqmPath<?> sqmPath, ModelPartContainer modelPartContainer, SqmToSqlAstConverter sqlAstCreationState)
Utility that returns the entity association target's mapping type if the specifiedsqmPath
should be dereferenced using the target table, i.e. when the path's lhs is an explicit join that is used in the group by clause, or defaults to the providedmodelPartContainer
otherwise.
-
isFkOptimizationAllowed
public static boolean isFkOptimizationAllowed(SqmPath<?> sqmPath)
Utility that returnsfalse
when the providedsqmPath
is a join that cannot be dereferenced through the foreign key on the associated table, i.e. a join that's neither SqmJoinType.INNER nor SqmJoinType.LEFT or one that has an explicit on clause predicate.
-
findCompatibleFetchJoin
public static <T,A> SqmAttributeJoin<T,A> findCompatibleFetchJoin(SqmFrom<?,T> sqmFrom, SqmPathSource<A> pathSource, SqmJoinType requestedJoinType)
-
generateJdbcParamsXref
public static Map<QueryParameterImplementor<?>,Map<SqmParameter<?>,List<JdbcParametersList>>> generateJdbcParamsXref(DomainParameterXref domainParameterXref, JdbcParameterBySqmParameterAccess jdbcParameterBySqmParameterAccess)
-
createJdbcParameterBindings
public static JdbcParameterBindings createJdbcParameterBindings(QueryParameterBindings domainParamBindings, DomainParameterXref domainParameterXref, Map<QueryParameterImplementor<?>,Map<SqmParameter<?>,List<JdbcParametersList>>> jdbcParamXref, MappingMetamodel domainModel, Function<NavigablePath,TableGroup> tableGroupLocator, SqmParameterMappingModelResolutionAccess mappingModelResolutionAccess, SharedSessionContractImplementor session)
-
determineParameterType
public static Bindable determineParameterType(QueryParameterBinding<?> binding, QueryParameterImplementor<?> parameter, List<SqmParameter<?>> sqmParameters, SqmParameterMappingModelResolutionAccess mappingModelResolutionAccess, SessionFactoryImplementor sessionFactory)
-
resolveParameters
public static SqmStatement.ParameterResolutions resolveParameters(SqmStatement<?> statement)
-
isSelectionAssignableToResultType
public static boolean isSelectionAssignableToResultType(SqmSelection<?> selection, Class<?> expectedResultType)
-
isHqlTuple
public static boolean isHqlTuple(SqmSelection<?> selection)
-
-