Top Description Inners Constructors Methods
org.hibernate.query.sqm.internal

public Class SqmUtil

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .IdentityHashMap, .Iterator, .LinkedHashSet, .List, .Locale, .Map, .Set, java.util.function.Function, org.hibernate.engine.spi.SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.internal.util.collections.CollectionHelper, org.hibernate.metamodel.MappingMetamodel, org.hibernate.metamodel.mapping.BasicValuedMapping, .Bindable, .EntityAssociationMapping, .EntityIdentifierMapping, .EntityMappingType, .ForeignKeyDescriptor, .JdbcMapping, .ManagedMappingType, .MappingModelExpressible, .ModelPartContainer, .PluralAttributeMapping, org.hibernate.query.IllegalQueryOperationException, .IllegalSelectQueryException, .Order, org.hibernate.query.criteria.JpaOrder, org.hibernate.query.spi.QueryParameterBinding, .QueryParameterBindings, .QueryParameterImplementor, org.hibernate.query.sqm.NodeBuilder, .SqmQuerySource, org.hibernate.query.sqm.spi.JdbcParameterBySqmParameterAccess, .SqmParameterMappingModelResolutionAccess, org.hibernate.query.sqm.tree.SqmDmlStatement, .SqmJoinType, .SqmStatement, org.hibernate.query.sqm.tree.domain.SqmPath, org.hibernate.query.sqm.tree.expression.JpaCriteriaParameter, .SqmAliasedNodeRef, .SqmJpaCriteriaParameterWrapper, .SqmParameter, org.hibernate.query.sqm.tree.from.SqmFrom, .SqmJoin, .SqmQualifiedJoin, .SqmRoot, org.hibernate.query.sqm.tree.select.SqmSelectStatement, .SqmSelectableNode, .SqmSortSpecification, org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.SqlTreeCreationException, org.hibernate.sql.ast.tree.expression.JdbcParameter, org.hibernate.sql.ast.tree.from.TableGroup, org.hibernate.sql.exec.internal.JdbcParameterBindingImpl, .JdbcParameterBindingsImpl, org.hibernate.sql.exec.spi.JdbcParameterBindings, .JdbcParametersList, org.hibernate.type.JavaObjectType, org.hibernate.type.descriptor.converter.spi.BasicValueConverter, org.hibernate.type.internal.BasicTypeImpl, .ConvertedBasicTypeImpl, org.hibernate.type.spi.TypeConfiguration

Helper utilities for dealing with SQM
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Bindable

Returns:

a reference to the same object o, but of type Bindable if possible, or null.
asBindable
(final Object
any object instance
o
)

Utility to mitigate issues related to type pollution.

private static List<JdbcParametersList>
convert(final List<List<JdbcParameter>> lists)

public static JdbcParameterBindings
private static void
createValueBindings(JdbcParameterBindings jdbcParameterBindings, QueryParameterImplementor<?> domainParam, QueryParameterBinding<?> domainParamBinding, Bindable parameterType, JdbcParametersList jdbcParams, Object bindValue, Function<NavigablePath, TableGroup> tableGroupLocator, SharedSessionContractImplementor session)

public static Bindable
determineParameterType(QueryParameterBinding<?> binding, QueryParameterImplementor<?> parameter, List<SqmParameter<?>> sqmParameters, SqmParameterMappingModelResolutionAccess mappingModelResolutionAccess, SessionFactoryImplementor sessionFactory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public static IllegalQueryOperationException
public static Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<JdbcParametersList>>>
generateJdbcParamsXref(DomainParameterXref domainParameterXref, JdbcParameterBySqmParameterAccess jdbcParameterBySqmParameterAccess)

public static boolean
isFkOptimizationAllowed(SqmPath<?> sqmPath)

Utility that returns false when the provided sqmPath 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.

public static boolean
public static boolean
public static boolean
needsTargetTableMapping(SqmPath<?> sqmPath, ModelPartContainer modelPartContainer)

Utility that returns true if the specified sqmPath should be dereferenced using the target table mapping, i.e. when the path's lhs is an explicit join.

public static SqmStatement.ParameterResolutions
pack-priv static <T> JpaOrder
sortSpecification(SqmSelectStatement<T> sqm, Order<? super T> order)

public static void
public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SqmUtilback to summary
private SqmUtil()

Method Detail

asBindableback to summary
private static Bindable asBindable(final Object o)

Utility to mitigate issues related to type pollution. Returns the passes object after casting it to Bindable, if the type is compatible. If it's not, null will be returned.

Parameters
o:Object

any object instance

Returns:Bindable

a reference to the same object o, but of type Bindable if possible, or null.

convertback to summary
private static List<JdbcParametersList> convert(final List<List<JdbcParameter>> lists)
createJdbcParameterBindingsback to summary
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)
createValueBindingsback to summary
private static void createValueBindings(JdbcParameterBindings jdbcParameterBindings, QueryParameterImplementor<?> domainParam, QueryParameterBinding<?> domainParamBinding, Bindable parameterType, JdbcParametersList jdbcParams, Object bindValue, Function<NavigablePath, TableGroup> tableGroupLocator, SharedSessionContractImplementor session)
determineParameterTypeback to summary
public static Bindable determineParameterType(QueryParameterBinding<?> binding, QueryParameterImplementor<?> parameter, List<SqmParameter<?>> sqmParameters, SqmParameterMappingModelResolutionAccess mappingModelResolutionAccess, SessionFactoryImplementor sessionFactory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

expectingNonSelectback to summary
public static IllegalQueryOperationException expectingNonSelect(SqmStatement<?> sqm, String hqlString)
generateJdbcParamsXrefback to summary
public static Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<JdbcParametersList>>> generateJdbcParamsXref(DomainParameterXref domainParameterXref, JdbcParameterBySqmParameterAccess jdbcParameterBySqmParameterAccess)
isFkOptimizationAllowedback to summary
public static boolean isFkOptimizationAllowed(SqmPath<?> sqmPath)

Utility that returns false when the provided sqmPath 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.

isMutationback to summary
public static boolean isMutation(SqmStatement<?> sqm)
isSelectback to summary
public static boolean isSelect(SqmStatement<?> sqm)
needsTargetTableMappingback to summary
public static boolean needsTargetTableMapping(SqmPath<?> sqmPath, ModelPartContainer modelPartContainer)

Utility that returns true if the specified sqmPath should be dereferenced using the target table mapping, i.e. when the path's lhs is an explicit join.

resolveParametersback to summary
public static SqmStatement.ParameterResolutions resolveParameters(SqmStatement<?> statement)
sortSpecificationback to summary
pack-priv static <T> JpaOrder sortSpecification(SqmSelectStatement<T> sqm, Order<? super T> order)
verifyIsNonSelectStatementback to summary
public static void verifyIsNonSelectStatement(SqmStatement<?> sqm, String hqlString)
verifyIsSelectStatementback to summary
public static void verifyIsSelectStatement(SqmStatement<?> sqm, String hqlString)
org.hibernate.query.sqm.internal back to summary

private Class SqmUtil.CriteriaParameterCollector

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.query.sqm.internal.SqmUtil.CriteriaParameterCollector

Field Summary

Modifier and TypeField and Description
private Map<JpaCriteriaParameter<?>, List<SqmJpaCriteriaParameterWrapper<?>>>
private Set<SqmParameter<?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private SqmStatement.ParameterResolutions
public void
process(SqmParameter<?> parameter)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jpaCriteriaParamResolutionsback to summary
private Map<JpaCriteriaParameter<?>, List<SqmJpaCriteriaParameterWrapper<?>>> jpaCriteriaParamResolutions
sqmParametersback to summary
private Set<SqmParameter<?>> sqmParameters

Constructor Detail

CriteriaParameterCollectorback to summary
private CriteriaParameterCollector()

Method Detail

makeResolutionback to summary
private SqmStatement.ParameterResolutions makeResolution()
processback to summary
public void process(SqmParameter<?> parameter)
org.hibernate.query.sqm.internal back to summary

private Class SqmUtil.ParameterResolutionsImpl

extends Object
implements ParameterResolutions
Class Inheritance
  • java.lang.Object
  • org.hibernate.query.sqm.internal.SqmUtil.ParameterResolutionsImpl
All Implemented Interfaces
org.hibernate.query.sqm.tree.SqmStatement.ParameterResolutions

Field Summary

Modifier and TypeField and Description
private final Map<JpaCriteriaParameter<?>, SqmJpaCriteriaParameterWrapper<?>>
private final Set<SqmParameter<?>>

Constructor Summary

AccessConstructor and Description
public
ParameterResolutionsImpl(Set<SqmParameter<?>> sqmParameters, Map<JpaCriteriaParameter<?>, List<SqmJpaCriteriaParameterWrapper<?>>> jpaCriteriaParamResolutions)

Method Summary

Modifier and TypeMethod and Description
public Map<JpaCriteriaParameter<?>, SqmJpaCriteriaParameterWrapper<?>>
public Set<SqmParameter<?>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jpaCriteriaParamResolutionsback to summary
private final Map<JpaCriteriaParameter<?>, SqmJpaCriteriaParameterWrapper<?>> jpaCriteriaParamResolutions
sqmParametersback to summary
private final Set<SqmParameter<?>> sqmParameters

Constructor Detail

ParameterResolutionsImplback to summary
public ParameterResolutionsImpl(Set<SqmParameter<?>> sqmParameters, Map<JpaCriteriaParameter<?>, List<SqmJpaCriteriaParameterWrapper<?>>> jpaCriteriaParamResolutions)

Method Detail

getJpaCriteriaParamResolutionsback to summary
public Map<JpaCriteriaParameter<?>, SqmJpaCriteriaParameterWrapper<?>> getJpaCriteriaParamResolutions()

Implements org.hibernate.query.sqm.tree.SqmStatement.ParameterResolutions.getJpaCriteriaParamResolutions.

Annotations
@Override
getSqmParametersback to summary
public Set<SqmParameter<?>> getSqmParameters()

Implements org.hibernate.query.sqm.tree.SqmStatement.ParameterResolutions.getSqmParameters.

Annotations
@Override