Class AbstractSqlAstTranslator<T extends JdbcOperation>

java.lang.Object
org.hibernate.dialect.sql.ast.spi.AbstractSqlAstTranslator<T>
All Implemented Interfaces:
Appendable, SqlAstWalker, SqlAstTranslator<T>, SqlAppender
Direct Known Subclasses:
SqlAstTranslatorWithMerge, SqlAstTranslatorWithOnDuplicateKeyUpdate, SqlAstTranslatorWithUpsert, StandardSqlAstTranslator

@SPI({USE,IMPLEMENT}) public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> extends Object implements SqlAstTranslator<T>, SqlAppender

Supported generic base for translating query and model-mutation SQL ASTs.

This class owns the single-use translation lifecycle, SQL buffer, parameter bindings, traversal stacks, and other mutable rendering context. A custom Dialect which renders SQL should extend this class, or a supported database-family subclass. A JDBC driver with a fundamentally different command language may instead implement SqlAstTranslator directly, normally on top of AbstractSqlAstWalker.

Prefer the focused get...Support() composition hooks when a difference can be expressed as selection of an immutable rendering plan. Override a protected rendering callback only when the database grammar cannot be represented by an existing support strategy. In either case, preserve the base class's stack and clause-management lifecycle; methods documented as owning that lifecycle should be entered through their visit... form.

Each instance translates exactly the SqlAstTranslationRequest supplied to its constructor and must not be cached or reused.

Since:
8.0
  • Constructor Details

  • Method Details

    • getTranslationRequest

      protected final SqlAstTranslationRequest<? extends Statement, T> getTranslationRequest()
    • setLockingTarget

      protected final void setLockingTarget(QuerySpec querySpec)
    • getSqlAst

      public final Statement getSqlAst()
      Description copied from interface: SqlAstTranslator
      The SQL AST assigned to this translator.
      Specified by:
      getSqlAst in interface SqlAstTranslator<T extends JdbcOperation>
    • getDialect

      protected Dialect getDialect()
    • getSessionFactory

      public final SessionFactoryImplementor getSessionFactory()
      Description copied from interface: SqlAstTranslator
      The SessionFactory whose services are used during translation.
      Specified by:
      getSessionFactory in interface SqlAstTranslator<T extends JdbcOperation>
    • castFunction

      protected final FunctionRenderer castFunction()
    • getWrapperOptions

      protected final WrapperOptions getWrapperOptions()
    • getIntegerType

      protected final BasicType<Integer> getIntegerType()
    • getStringType

      protected final BasicType<String> getStringType()
    • getBooleanType

      protected final BasicType<Boolean> getBooleanType()
    • getSql

      protected final String getSql()
    • renderStatementPrefix

      protected final void renderStatementPrefix(Consumer<SqlAppender> renderer)
      Render and atomically prepend a statement-level SQL prefix without exposing the mutable main SQL buffer.
    • getSqlBuffer

      @Internal public StringBuilder getSqlBuffer()
    • getParameterBinders

      protected final List<JdbcParameterBinder> getParameterBinders()
    • getAffectedTableNames

      public final Set<String> getAffectedTableNames()
      Description copied from interface: SqlAstTranslator
      Not the best spot for this. Returns the table names collected while walking the SQL AST. It's ok here because the translator is consider a one-time-use. It just needs to be called after translation. A better option is probably to have "translation" objects that expose the affected table-names.
      Specified by:
      getAffectedTableNames in interface SqlAstTranslator<T extends JdbcOperation>
    • addAffectedTableName

      public final void addAffectedTableName(String tableName)
      Description copied from interface: SqlAstTranslator
      Register an affected physical table name while translating a mutation.
      Specified by:
      addAffectedTableName in interface SqlAstTranslator<T extends JdbcOperation>
    • getStatement

      protected final Statement getStatement()
    • getCurrentDmlStatement

      protected final MutationStatement getCurrentDmlStatement()
    • getParameterRenderingMode

      protected SqlAstNodeRenderingMode getParameterRenderingMode()
    • addAdditionalWherePredicate

      protected final void addAdditionalWherePredicate(Predicate predicate)
    • appendSql

      public void appendSql(String fragment)
      Description copied from interface: SqlAppender
      Add the passed fragment into the in-flight buffer
      Specified by:
      appendSql in interface SqlAppender
    • appendSql

      public void appendSql(char fragment)
      Specified by:
      appendSql in interface SqlAppender
    • appendSql

      public void appendSql(int value)
      Specified by:
      appendSql in interface SqlAppender
    • appendSql

      public void appendSql(long value)
      Specified by:
      appendSql in interface SqlAppender
    • appendSql

      public void appendSql(double value)
      Specified by:
      appendSql in interface SqlAppender
    • appendSql

      public void appendSql(float value)
      Specified by:
      appendSql in interface SqlAppender
    • appendSql

      public void appendSql(boolean value)
      Specified by:
      appendSql in interface SqlAppender
    • appendDoubleQuoteEscapedString

      public void appendDoubleQuoteEscapedString(String value)
      Specified by:
      appendDoubleQuoteEscapedString in interface SqlAppender
    • appendSingleQuoteEscapedString

      public void appendSingleQuoteEscapedString(String value)
      Specified by:
      appendSingleQuoteEscapedString in interface SqlAppender
    • append

      public Appendable append(CharSequence csq)
      Specified by:
      append in interface Appendable
      Specified by:
      append in interface SqlAppender
    • append

      public Appendable append(CharSequence csq, int start, int end)
      Specified by:
      append in interface Appendable
      Specified by:
      append in interface SqlAppender
    • append

      public Appendable append(char c)
      Specified by:
      append in interface Appendable
      Specified by:
      append in interface SqlAppender
    • getJdbcServices

      protected final JdbcServices getJdbcServices()
    • getJdbcParameterBindings

      protected final JdbcParameterBindings getJdbcParameterBindings()
    • getLockOptions

      protected final LockOptions getLockOptions()
    • getLimit

      protected final Limit getLimit()
    • hasLimit

      protected final boolean hasLimit()
    • hasLimit

      protected final boolean hasLimit(QueryPart queryPart)
    • hasOffset

      protected final boolean hasOffset(QueryPart queryPart)
    • useOffsetFetchClause

      protected final boolean useOffsetFetchClause(QueryPart queryPart)
    • isRowsOnlyFetchClauseType

      protected final boolean isRowsOnlyFetchClauseType(QueryPart queryPart)
    • getOffsetParameter

      protected final JdbcParameter getOffsetParameter()
    • getLimitParameter

      protected final JdbcParameter getLimitParameter()
    • getLiteralValue

      public final <X> X getLiteralValue(Expression expression)
      Description copied from interface: SqlAstTranslator
      Returns the literal value of the given expression, inlining a parameter value if necessary.
      Specified by:
      getLiteralValue in interface SqlAstTranslator<T extends JdbcOperation>
    • interpretExpression

      protected <R> R interpretExpression(Expression expression, JdbcParameterBindings jdbcParameterBindings)
    • renderExpressionAsLiteral

      protected void renderExpressionAsLiteral(Expression expression, JdbcParameterBindings jdbcParameterBindings)
    • getParameterBindValue

      protected Object getParameterBindValue(JdbcParameter parameter)
    • getLeftHandExpression

      protected Expression getLeftHandExpression(Predicate predicate)
    • inOverOrWithinGroupClause

      protected boolean inOverOrWithinGroupClause()
    • getClauseStack

      protected final Stack<Clause> getClauseStack()
    • getStatementStack

      protected final Stack<Statement> getStatementStack()
    • getQueryPartStack

      protected final Stack<QueryPart> getQueryPartStack()
    • getCurrentQueryPart

      public final QueryPart getCurrentQueryPart()
      Description copied from interface: SqlAstTranslator
      The query part at the top of the translator's traversal stack.
      Specified by:
      getCurrentQueryPart in interface SqlAstTranslator<T extends JdbcOperation>
    • getCurrentClauseStack

      public final Stack<Clause> getCurrentClauseStack()
      Description copied from interface: SqlAstTranslator
      Read-only access to the translator's current clause stack. Providers should inspect but not mutate this stack.
      Specified by:
      getCurrentClauseStack in interface SqlAstTranslator<T extends JdbcOperation>
    • getCteStatement

      protected final CteStatement getCteStatement(String cteName)
    • translate

      public final T translate(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions)
      Description copied from interface: SqlAstTranslator
      Perform this translator's one translation.
      Specified by:
      translate in interface SqlAstTranslator<T extends JdbcOperation>
      Parameters:
      jdbcParameterBindings - parameter values available for literalization and JDBC binding
      queryOptions - execution options which affect translation
      Returns:
      the JDBC operation produced from this translator's SQL AST
    • determineUniqueConstraintNameThatMayFail

      protected String determineUniqueConstraintNameThatMayFail(InsertSelectStatement sqlAst)
    • renderColumnWrite

      protected void renderColumnWrite(ColumnValueBinding selectionBinding)
    • visitSelectStatement

      public final void visitSelectStatement(SelectStatement statement)
      Specified by:
      visitSelectStatement in interface SqlAstWalker
    • renderSelectStatement

      protected void renderSelectStatement(SelectStatement statement)
      Render the SQL for a select statement after the base has established its statement-stack and parameter-rendering-mode invariants. Overrides may decorate or replace the standard rendering and may delegate to super to retain it.
    • visitDeleteStatement

      public final void visitDeleteStatement(DeleteStatement statement)
      Specified by:
      visitDeleteStatement in interface SqlAstWalker
    • visitUpdateStatement

      public final void visitUpdateStatement(UpdateStatement statement)
      Specified by:
      visitUpdateStatement in interface SqlAstWalker
    • visitAssignment

      public void visitAssignment(Assignment assignment)
      Specified by:
      visitAssignment in interface SqlAstWalker
    • visitInsertStatement

      public final void visitInsertStatement(InsertSelectStatement statement)
      Specified by:
      visitInsertStatement in interface SqlAstWalker
    • visitDeleteStatementOnly

      protected void visitDeleteStatementOnly(DeleteStatement statement)
    • getQueryMutationRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected QueryMutationRenderingSupport getQueryMutationRenderingSupport()

      Supplies the strategy which selects query update and delete rendering plans.

      Override this hook to compose database-specific plan selection without taking ownership of statement traversal. The returned support must be non-null and must not retain supplied requests or translator state.

    • renderDeleteStatementDirect

      protected final void renderDeleteStatementDirect(DeleteStatement statement)
    • renderDeleteStatementWithJoinEmulation

      protected final void renderDeleteStatementWithJoinEmulation(DeleteStatement statement, @Nullable String targetAlias)
    • visitDeleteClause

      protected final void visitDeleteClause(DeleteStatement statement)
    • renderDeleteClause

      @SPI(IMPLEMENT) protected void renderDeleteClause(DeleteStatement statement)
    • visitUpdateStatementOnly

      protected void visitUpdateStatementOnly(UpdateStatement statement)
    • renderUpdateStatementDirect

      protected final void renderUpdateStatementDirect(UpdateStatement statement)
    • renderUpdateStatementAsScalarSubquery

      protected final void renderUpdateStatementAsScalarSubquery(UpdateStatement statement)
    • visitUpdateClause

      protected final void visitUpdateClause(UpdateStatement statement)
    • renderUpdateClause

      @SPI(IMPLEMENT) protected void renderUpdateClause(UpdateStatement updateStatement)
    • renderDmlTargetTableExpression

      protected void renderDmlTargetTableExpression(NamedTableReference tableReference)
    • hasNonTrivialFromClause

      protected static boolean hasNonTrivialFromClause(FromClause fromClause)
    • renderSetClause

      protected final void renderSetClause(List<Assignment> assignments)
    • visitSetAssignment

      protected final void visitSetAssignment(Assignment assignment)
    • renderSetAssignment

      @SPI(IMPLEMENT) protected void renderSetAssignment(Assignment assignment)
    • renderAssignmentColumn

      @SPI(IMPLEMENT) protected void renderAssignmentColumn(ColumnReference column)
    • renderSetAssignmentEmulateJoin

      protected final void renderSetAssignmentEmulateJoin(Assignment assignment, UpdateStatement statement)
    • isStruct

      protected boolean isStruct(JdbcMappingContainer expressionType)
    • isLob

      @SPI(USE) protected static boolean isLob(JdbcMappingContainer expressionType)
    • getInsertConflictRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected InsertConflictRenderingSupport getInsertConflictRenderingSupport()

      Supplies the strategy which selects insert-conflict rendering plans.

      Override this hook when the database's native or emulated conflict syntax differs from StandardInsertConflictRenderingSupport.CONSTRAINT_VIOLATION. The returned support must be non-null and must not retain supplied requests or translator state.

    • isIntegerDivisionEmulationRequired

      protected boolean isIntegerDivisionEmulationRequired(BinaryArithmeticExpression expression)
    • renderInsertStatementAsMerge

      protected final void renderInsertStatementAsMerge(InsertSelectStatement statement)
    • renderUpdateStatementAsMerge

      protected final void renderUpdateStatementAsMerge(UpdateStatement statement)
    • renderUpdateStatementAsInlineView

      protected final void renderUpdateStatementAsInlineView(UpdateStatement statement)
    • renderUpdateStatementAsTupleSet

      protected final void renderUpdateStatementAsTupleSet(UpdateStatement statement)
    • renderMergeUpdateClause

      @SPI(IMPLEMENT) protected void renderMergeUpdateClause(List<Assignment> assignments, Predicate wherePredicate)
    • visitValuesList

      protected final void visitValuesList(List<Values> valuesList)
    • renderValuesListStandard

      protected final void renderValuesListStandard(List<Values> valuesList)
    • renderValuesListAsSelectUnion

      protected final void renderValuesListAsSelectUnion(List<Values> valuesList)
    • getLockingClauseStrategy

      protected LockingClauseStrategy getLockingClauseStrategy()
    • visitForUpdateClause

      protected void visitForUpdateClause(QuerySpec querySpec)
    • getEffectiveLockMode

      protected LockMode getEffectiveLockMode()
    • getEffectiveLockMode

      protected LockMode getEffectiveLockMode(String alias)
    • getEffectiveLockMode

      protected LockMode getEffectiveLockMode(String alias, boolean isRoot)
    • getEffectiveLockTimeout

      protected int getEffectiveLockTimeout(LockMode lockMode)
    • hasAggregateFunctions

      protected boolean hasAggregateFunctions(QuerySpec querySpec)
    • determineLockingStrategy

      protected AbstractSqlAstTranslator.LockStrategy determineLockingStrategy(QuerySpec querySpec, Locking.FollowOn followOnStrategy)
    • renderStandardConflictClause

      protected final void renderStandardConflictClause(ConflictClause conflictClause)
    • renderOnDuplicateKeyConflictClause

      protected final void renderOnDuplicateKeyConflictClause(InsertSelectStatement statement, ConflictClause conflictClause, InsertConflictRenderingPlan.OnDuplicateKey plan)
    • getReturningRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected ReturningRenderingSupport getReturningRenderingSupport()

      Supplies the strategy which selects how mutations return generated column values.

      Override this hook to select a trailing clause or data-change-table plan; leave column traversal and SQL emission to the translator. The returned support must be non-null and must not retain supplied requests.

    • visitCteContainer

      public final void visitCteContainer(CteContainer cteContainer)
    • getCteParameterRenderingMode

      protected SqlAstNodeRenderingMode getCteParameterRenderingMode()
      The parameter rendering mode to use while rendering a CTE container.
    • determineCyclePathColumnName

      protected String determineCyclePathColumnName(CteStatement cte)
    • isInRecursiveQueryPart

      protected boolean isInRecursiveQueryPart()
    • isInSubquery

      protected boolean isInSubquery()
    • needsCteInlining

      protected boolean needsCteInlining()
      Whether CTEs should be inlined rather than rendered as CTEs.
    • shouldInlineCte

      protected boolean shouldInlineCte(TableGroup tableGroup)
      Whether CTEs should be inlined rather than rendered as CTEs.
    • renderMaterializationHint

      protected void renderMaterializationHint(CteMaterialization materialization)
    • renderSearchClause

      protected void renderSearchClause(CteStatement cte)
    • renderStandardSearchClause

      protected final void renderStandardSearchClause(CteStatement cte)
    • renderCycleClause

      protected void renderCycleClause(CteStatement cte)
    • renderStandardCycleClause

      protected final void renderStandardCycleClause(CteStatement cte)
    • renderCycleUsingClause

      protected void renderCycleUsingClause(CteStatement cte)
      Render the optional path column of a standard CTE cycle clause.
    • renderRecursiveCteVirtualSelections

      protected void renderRecursiveCteVirtualSelections(SelectClause selectClause)
    • emulateSearchClauseOrderWithRowAndArray

      protected void emulateSearchClauseOrderWithRowAndArray(SelectClause selectClause)
    • visitRecursivePath

      protected void visitRecursivePath(Expression recursivePath, int sizeEstimate)
      Renders the recursive path, possibly wrapping a cast expression around it, to make sure a type with proper size is chosen.
    • emulateCycleClauseWithRowAndArray

      protected void emulateCycleClauseWithRowAndArray(SelectClause selectClause)
    • getArrayContainsFunction

      protected String getArrayContainsFunction()
      Returns the name of the array_contains(array, element) function, which is used for emulating the cycle clause.
    • renderStringContainsExactlyPredicate

      protected void renderStringContainsExactlyPredicate(Expression haystack, Expression needle)
    • castNumberToString

      protected Expression castNumberToString(Expression expression, int precision, int scale)
      Casts a number expression to a string with the given precision and scale.
    • visitQueryGroup

      public void visitQueryGroup(QueryGroup queryGroup)
      Specified by:
      visitQueryGroup in interface SqlAstWalker
    • renderQueryGroupWithoutOrderByAndOffsetFetch

      protected final void renderQueryGroupWithoutOrderByAndOffsetFetch(QueryGroup queryGroup)
      Render a query group without its order-by and offset/fetch clauses. This supports dialect grammars which render those clauses on an outer wrapper.
    • afterQueryGroup

      protected void afterQueryGroup(QueryGroup queryGroup, QueryPart currentQueryPart)
    • beforeQueryGroup

      protected void beforeQueryGroup(QueryGroup queryGroup, QueryPart currentQueryPart)
    • visitQuerySpec

      public void visitQuerySpec(QuerySpec querySpec)
      Specified by:
      visitQuerySpec in interface SqlAstWalker
    • visitQueryClauses

      protected void visitQueryClauses(QuerySpec querySpec)
    • getGroupBySelectItemReferenceStrategy

      @SPI({IMPLEMENT,SUPPLY}) protected SelectItemReferenceStrategy getGroupBySelectItemReferenceStrategy()

      Select how this translator refers to select items in a group by clause.

      Return one non-null stable choice without mutating the request or renderer state. Override this focused hook instead of replacing group-by traversal.

      Returns:
      the select-item reference strategy
      Since:
      8.0
      See Also:
    • visitWhereClause

      protected final void visitWhereClause(Predicate whereClauseRestrictions)
    • hasWhere

      protected boolean hasWhere(Predicate whereClauseRestrictions)
    • resolveAliasedExpression

      protected Expression resolveAliasedExpression(Expression expression)
    • resolveAliasedExpression

      protected Expression resolveAliasedExpression(List<SqlSelection> sqlSelections, Expression expression)
    • resolveExpressionToAlias

      protected Expression resolveExpressionToAlias(Expression expression)
    • visitGroupByClause

      protected final void visitGroupByClause(QuerySpec querySpec, SelectItemReferenceStrategy referenceStrategy)
    • visitPartitionByClause

      protected final void visitPartitionByClause(List<Expression> partitionExpressions)
    • visitPartitionExpressions

      protected final void visitPartitionExpressions(List<Expression> partitionExpressions, SelectItemReferenceStrategy referenceStrategy)
    • visitPartitionExpressions

      protected final void visitPartitionExpressions(List<Expression> partitionExpressions, Function<Expression, Expression> resolveAliasExpression, boolean inlineParametersOfAliasedExpressions)
    • renderPartitionItem

      protected void renderPartitionItem(Expression expression)
    • visitHavingClause

      protected final void visitHavingClause(QuerySpec querySpec)
    • visitOrderBy

      protected void visitOrderBy(List<SortSpecification> sortSpecifications)
    • renderOrderByClause

      protected final void renderOrderByClause(List<SortSpecification> sortSpecifications)
      Render a standard order-by clause, including its leading whitespace.
    • renderEmptyOrderBy

      protected void renderEmptyOrderBy()
      Render the ordering required by a window with no sort specifications. The default implementation renders nothing.
    • emulateSelectTupleComparison

      protected void emulateSelectTupleComparison(List<SqlSelection> lhsSelections, List<? extends SqlAstNode> rhsExpressions, ComparisonOperator operator, boolean indexOptimized)
    • emulateTupleComparison

      protected void emulateTupleComparison(List<? extends SqlAstNode> lhsExpressions, List<? extends SqlAstNode> rhsExpressions, ComparisonOperator operator, boolean indexOptimized)
      A tuple comparison like (a, b) > (1, 2) can be emulated through it logical definition: a > 1 or a = 1 and b > 2. The normal tuple comparison emulation is not very index friendly though because of the top level OR predicate. Index optimized emulation of tuple comparisons puts an AND predicate on the top level. The effect of that is, that the database can do an index seek to efficiently find a superset of matching rows. Generally, it is sufficient to just add a broader predicate like for (a, b) > (1, 2) we add a >= 1 and (..). But we can further optimize this if we just remove the non-matching parts from this too broad predicate. For (a, b, c) > (1, 2, 3) we use the broad predicate a >= 1 and then want to remove rows where a = 1 and (b, c) <= (2, 3)
    • renderExpressionsAsSubquery

      protected void renderExpressionsAsSubquery(List<? extends Expression> expressions)
    • renderSelectSimpleComparison

      protected void renderSelectSimpleComparison(List<SqlSelection> lhsExpressions, Expression expression, ComparisonOperator operator)
    • renderSelectTupleComparison

      protected void renderSelectTupleComparison(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)
    • renderTupleComparisonStandard

      protected void renderTupleComparisonStandard(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)
    • renderComparison

      protected void renderComparison(Expression lhs, ComparisonOperator operator, Expression rhs)
    • renderComparisonStandard

      protected void renderComparisonStandard(Expression lhs, ComparisonOperator operator, Expression rhs)
    • renderComparisonDistinctOperator

      protected void renderComparisonDistinctOperator(Expression lhs, ComparisonOperator operator, Expression rhs)
    • renderComparisonEmulateDecode

      protected void renderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs)
    • renderComparisonEmulateDecode

      protected void renderComparisonEmulateDecode(Expression lhs, ComparisonOperator operator, Expression rhs, SqlAstNodeRenderingMode firstArgRenderingMode)
    • renderComparisonEmulateCase

      protected void renderComparisonEmulateCase(Expression lhs, ComparisonOperator operator, Expression rhs)
    • renderComparisonEmulateIntersect

      protected void renderComparisonEmulateIntersect(Expression lhs, ComparisonOperator operator, Expression rhs)
    • visitSortSpecification

      public final void visitSortSpecification(SortSpecification sortSpecification)
      Specified by:
      visitSortSpecification in interface SqlAstWalker
    • visitSortSpecification

      protected void visitSortSpecification(Expression sortExpression, SortDirection sortOrder, Nulls nullPrecedence, boolean ignoreCase)
    • renderSortExpression

      protected void renderSortExpression(Expression sortExpression, boolean ignoreCase)
    • emulateSortSpecificationNullPrecedence

      protected void emulateSortSpecificationNullPrecedence(Expression sortExpression, Nulls nullPrecedence)
    • getPaginationRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected PaginationRenderingSupport getPaginationRenderingSupport()

      Supplies the strategy which selects SQL AST pagination plans.

      This hook controls pagination represented in the SQL AST. It is distinct from LimitHandler, which rewrites already-rendered SQL for execution-time query limits. The returned support must be non-null and must not retain supplied requests.

    • determinePaginationRenderingPlan

      protected final PaginationRenderingPlan determinePaginationRenderingPlan(QueryPart queryPart)
    • visitOffsetFetchClause

      public void visitOffsetFetchClause(QueryPart queryPart)
      Specified by:
      visitOffsetFetchClause in interface SqlAstWalker
    • renderOffsetFetchClause

      protected void renderOffsetFetchClause(QueryPart queryPart, boolean renderOffsetRowsKeyword)
    • renderOffsetFetchClause

      protected void renderOffsetFetchClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean renderOffsetRowsKeyword)
    • renderOffset

      protected void renderOffset(Expression offsetExpression, boolean renderOffsetRowsKeyword)
    • renderFetch

      protected void renderFetch(Expression fetchExpression, Expression offsetExpressionToAdd, FetchClauseType fetchClauseType)
    • renderOffsetExpression

      protected void renderOffsetExpression(Expression offsetExpression)
    • renderFetchExpression

      protected void renderFetchExpression(Expression fetchExpression)
    • renderTopClause

      protected void renderTopClause(QuerySpec querySpec, boolean addOffset, boolean needsParenthesis)
    • renderTopClause

      protected void renderTopClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean addOffset, boolean needsParenthesis)
    • renderTopStartAtClause

      protected void renderTopStartAtClause(QuerySpec querySpec)
    • renderTopStartAtClause

      protected void renderTopStartAtClause(Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType)
    • renderFetchPlusOffsetExpression

      protected void renderFetchPlusOffsetExpression(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset)
    • renderFetchPlusOffsetExpressionAsLiteral

      protected void renderFetchPlusOffsetExpressionAsLiteral(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset)
    • renderFetchPlusOffsetExpressionAsSingleParameter

      protected void renderFetchPlusOffsetExpressionAsSingleParameter(Expression fetchClauseExpression, Expression offsetClauseExpression, int offset)
    • renderFirstSkipClause

      protected void renderFirstSkipClause(QuerySpec querySpec)
    • renderFirstSkipClause

      protected void renderFirstSkipClause(Expression offsetExpression, Expression fetchExpression)
    • renderSkipFirstClause

      protected void renderSkipFirstClause(QuerySpec querySpec)
    • renderSkipFirstClause

      protected void renderSkipFirstClause(Expression offsetExpression, Expression fetchExpression)
    • renderFirstClause

      protected void renderFirstClause(QuerySpec querySpec)
    • renderFirstClause

      protected void renderFirstClause(Expression offsetExpression, Expression fetchExpression)
    • renderRowsToClause

      protected void renderRowsToClause(QuerySpec querySpec)
    • renderRowsToClause

      protected void renderRowsToClause(Expression offsetExpression, Expression fetchExpression)
    • renderCombinedLimitClause

      protected void renderCombinedLimitClause(QueryPart queryPart)
    • renderCombinedLimitClause

      protected void renderCombinedLimitClause(Expression offsetExpression, Expression fetchExpression)
    • renderLimitOffsetClause

      protected void renderLimitOffsetClause(QueryPart queryPart)
    • renderLimitOffsetClause

      protected void renderLimitOffsetClause(Expression offsetExpression, Expression fetchExpression)
    • assertRowsOnlyFetchClauseType

      protected void assertRowsOnlyFetchClauseType(QueryPart queryPart)
    • getQueryPartForRowNumbering

      protected QueryPart getQueryPartForRowNumbering()
    • isRowNumberingCurrentQueryPart

      protected boolean isRowNumberingCurrentQueryPart()
    • emulateFetchOffsetWithWindowFunctions

      protected void emulateFetchOffsetWithWindowFunctions(QueryPart queryPart, boolean emulateFetchClause)
    • emulateFetchOffsetWithWindowFunctions

      protected void emulateFetchOffsetWithWindowFunctions(QueryPart queryPart, Expression offsetExpression, Expression fetchExpression, FetchClauseType fetchClauseType, boolean emulateFetchClause)
    • emulateFetchOffsetWithWindowFunctionsVisitQueryPart

      protected void emulateFetchOffsetWithWindowFunctionsVisitQueryPart(QueryPart queryPart)
    • withRowNumbering

      protected final void withRowNumbering(QueryPart queryPart, boolean needsSelectAliases, Runnable r)
    • visitSelectClause

      public final void visitSelectClause(SelectClause selectClause)
      Specified by:
      visitSelectClause in interface SqlAstWalker
    • renderSelectClause

      protected void renderSelectClause(SelectClause selectClause)
      Render the select clause after the base has established its clause-stack invariant.
    • renderCteSelectHint

      protected void renderCteSelectHint(CteStatement cte)
      Render a hint immediately after the first select keyword of the given CTE definition.
    • renderSelectItems

      protected void renderSelectItems(SelectClause selectClause)
    • renderVirtualSelections

      protected final void renderVirtualSelections(SelectClause selectClause)
    • getSelectItemReference

      protected final SqlSelectionExpression getSelectItemReference(Expression expression)
    • renderRowNumberingSelectItems

      protected void renderRowNumberingSelectItems(SelectClause selectClause, QueryPart queryPart)
    • getFetchClauseTypeForRowNumbering

      protected FetchClauseType getFetchClauseTypeForRowNumbering(QueryPart queryPartForRowNumbering)
    • visitOver

      public void visitOver(Over<?> over)
      Specified by:
      visitOver in interface SqlAstWalker
    • visitOverClause

      protected final void visitOverClause(List<Expression> partitionExpressions, List<SortSpecification> sortSpecifications)
    • visitOverClause

      protected void visitOverClause(List<Expression> partitionExpressions, List<SortSpecification> sortSpecifications, FrameMode mode, FrameKind startKind, Expression startExpression, FrameKind endKind, Expression endExpression, FrameExclusion exclusion, boolean orderedSetAggregate)
    • renderRowNumber

      protected void renderRowNumber(SelectClause selectClause, QueryPart queryPart)
    • isParameter

      public static boolean isParameter(Expression expression)
    • getVersionSeedMapping

      @SPI(USE) @Nullable protected final EntityVersionMapping getVersionSeedMapping(Expression expression)

      Returns the version mapping when the expression is Hibernate's generated optimistic-lock version-seed parameter.

      This method returns null for every other expression. It does not create the seed value, render the expression, or bind the parameter.

      Since:
      8.0
    • isParameterInterpretation

      @SPI(USE) protected final boolean isParameterInterpretation(Expression expression)

      Whether the expression represents Hibernate's interpretation of an SQM parameter.

      Unlike isParameter(Expression), this method returns false for an ordinary JdbcParameter.

      Since:
      8.0
    • isLiteral

      protected final boolean isLiteral(Expression expression)
    • getSortSpecificationsRowNumbering

      protected List<SortSpecification> getSortSpecificationsRowNumbering(SelectClause selectClause, QueryPart queryPart)
    • visitSqlSelection

      public final void visitSqlSelection(SqlSelection sqlSelection)
      Specified by:
      visitSqlSelection in interface SqlAstWalker
    • visitSqlSelectExpression

      protected void visitSqlSelectExpression(Expression expression)
    • renderSelectExpression

      protected void renderSelectExpression(Expression expression)
    • renderExpressionAsClauseItem

      protected void renderExpressionAsClauseItem(Expression expression)
    • renderSelectExpressionWithCastedOrInlinedPlainParameters

      protected void renderSelectExpressionWithCastedOrInlinedPlainParameters(Expression expression)
    • renderCasted

      protected void renderCasted(Expression expression)
    • renderLiteral

      protected void renderLiteral(Literal literal, boolean castParameter)
    • visitFromClause

      public final void visitFromClause(FromClause fromClause)
      Specified by:
      visitFromClause in interface SqlAstWalker
    • hasFrom

      protected final boolean hasFrom(FromClause fromClause)
    • renderFromClauseSpaces

      protected final void renderFromClauseSpaces(FromClause fromClause)
    • renderFromClauseAfterUpdateSet

      protected void renderFromClauseAfterUpdateSet(UpdateStatement statement)
    • renderFromClauseExcludingDmlTargetReference

      protected void renderFromClauseExcludingDmlTargetReference(UpdateStatement statement)
    • renderFromClauseJoiningDmlTargetReference

      protected void renderFromClauseJoiningDmlTargetReference(UpdateStatement statement)
    • needsLocking

      @SPI(USE) protected final boolean needsLocking(QuerySpec querySpec)
    • renderPrimaryTableReferencePrefix

      @SPI(IMPLEMENT) protected void renderPrimaryTableReferencePrefix(PrimaryTableReferenceContext context)

      Render any database-specific introducer immediately before a primary table reference.

      Override this focused hook for grammar such as a required table prefix. Do not render the reference itself or change traversal state.

    • hasTargetTableCorrelation

      @SPI(USE) protected final boolean hasTargetTableCorrelation(MutationStatement statement)
    • hasNestedOrTargetTableCorrelation

      @SPI(USE) protected final boolean hasNestedOrTargetTableCorrelation(MutationStatement statement)
    • visitValuesTableReference

      public final void visitValuesTableReference(ValuesTableReference tableReference)
      Specified by:
      visitValuesTableReference in interface SqlAstWalker
    • visitQueryPartTableReference

      public final void visitQueryPartTableReference(QueryPartTableReference tableReference)
      Specified by:
      visitQueryPartTableReference in interface SqlAstWalker
    • visitFunctionTableReference

      public final void visitFunctionTableReference(FunctionTableReference tableReference)
      Specified by:
      visitFunctionTableReference in interface SqlAstWalker
    • renderNamedSetReturningFunction

      @SPI(USE) public final void renderNamedSetReturningFunction(String functionName, List<? extends SqlAstNode> sqlAstArguments, SetReturningFunctionType tupleType, String tableIdentifierVariable, SqlAstNodeRenderingMode argumentRenderingMode)
      Description copied from interface: SqlAstTranslator
      Renders a named set returning function.
      Specified by:
      renderNamedSetReturningFunction in interface SqlAstTranslator<T extends JdbcOperation>
    • getSetReturningFunctionRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected SetReturningFunctionRenderingSupport getSetReturningFunctionRenderingSupport()

      Supplies the strategy which selects named set-returning-function plans.

      Override this hook to select native invocation, wrapping, or ordinality emulation while leaving argument traversal and SQL emission to the translator. The support must not be null and must not retain a supplied request.

    • renderQueryPartTableReferenceWithSelectListAliases

      protected final void renderQueryPartTableReferenceWithSelectListAliases(QueryPartTableReference tableReference)
    • renderValuesTableReferenceWithSelectListAliases

      protected final void renderValuesTableReferenceWithSelectListAliases(ValuesTableReference tableReference)
    • renderDerivedTableReferenceIdentificationVariable

      protected final void renderDerivedTableReferenceIdentificationVariable(DerivedTableReference tableReference)
    • getDerivedTableRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected DerivedTableRenderingSupport getDerivedTableRenderingSupport()

      Supplies the strategy which selects derived-table rendering plans.

      Override this hook to customize query-part, values-table, or function-table syntax without overriding their traversal callbacks. The returned support must be non-null and must not retain supplied requests or translator state.

    • isRenderingLateralDerivedTable

      protected final boolean isRenderingLateralDerivedTable()
    • isRenderingCorrelatedDerivedTable

      protected final boolean isRenderingCorrelatedDerivedTable()
    • isRenderingDerivedTable

      protected final boolean isRenderingDerivedTable(DerivedTableKind kind)
    • withoutLateralDerivedTableContext

      protected final void withoutLateralDerivedTableContext(Runnable renderer)
    • renderTableReferenceIdentificationVariable

      @SPI(USE) protected final void renderTableReferenceIdentificationVariable(TableReference tableReference)
    • renderTableReferenceAlias

      @SPI(IMPLEMENT) protected void renderTableReferenceAlias(String alias, TableReferenceAliasContext context)

      Render a table-reference alias in its semantic statement context.

      Override this hook when target-table alias syntax differs from ordinary from-clause alias syntax. Implementations must render the supplied alias exactly once and must not retain the context.

    • registerAffectedTable

      protected void registerAffectedTable(NamedTableReference tableReference)
    • registerAffectedTable

      protected void registerAffectedTable(String tableExpression)
    • getTableJoinRenderingSupport

      @SPI({IMPLEMENT,SUPPLY}) protected TableJoinRenderingSupport getTableJoinRenderingSupport()

      Supplies the strategy which selects table-join rendering plans.

      Override this hook for contextual alternatives such as comma joins or apply syntax. The translator remains responsible for predicates and traversal. The support must not be null and must not retain a supplied request.

    • determineLateralEmulationPredicate

      protected Predicate determineLateralEmulationPredicate(TableGroup tableGroup)
    • shouldEmulateLateralWithIntersect

      protected boolean shouldEmulateLateralWithIntersect(QueryPart queryPart)
    • visitTableGroup

      public final void visitTableGroup(TableGroup tableGroup)
      Specified by:
      visitTableGroup in interface SqlAstWalker
    • visitTableGroupJoin

      public final void visitTableGroupJoin(TableGroupJoin tableGroupJoin)
      Specified by:
      visitTableGroupJoin in interface SqlAstWalker
    • visitNamedTableReference

      public final void visitNamedTableReference(NamedTableReference tableReference)
      Specified by:
      visitNamedTableReference in interface SqlAstWalker
    • visitTableReferenceJoin

      public final void visitTableReferenceJoin(TableReferenceJoin tableReferenceJoin)
      Specified by:
      visitTableReferenceJoin in interface SqlAstWalker
    • visitColumnReference

      public void visitColumnReference(ColumnReference columnReference)
      Specified by:
      visitColumnReference in interface SqlAstWalker
    • visitNestedColumnReference

      public void visitNestedColumnReference(NestedColumnReference nestedColumnReference)
      Specified by:
      visitNestedColumnReference in interface SqlAstWalker
    • visitAggregateColumnWriteExpression

      public void visitAggregateColumnWriteExpression(AggregateColumnWriteExpression aggregateColumnWriteExpression)
      Specified by:
      visitAggregateColumnWriteExpression in interface SqlAstWalker
    • determineColumnReferenceQualifier

      protected String determineColumnReferenceQualifier(ColumnReference columnReference)
    • visitExtractUnit

      public void visitExtractUnit(ExtractUnit extractUnit)
      Specified by:
      visitExtractUnit in interface SqlAstWalker
    • visitDurationUnit

      public void visitDurationUnit(DurationUnit unit)
      Specified by:
      visitDurationUnit in interface SqlAstWalker
    • visitFormat

      public void visitFormat(Format format)
      Specified by:
      visitFormat in interface SqlAstWalker
    • visitStar

      public void visitStar(Star star)
      Specified by:
      visitStar in interface SqlAstWalker
    • visitTrimSpecification

      public void visitTrimSpecification(TrimSpecification trimSpecification)
      Specified by:
      visitTrimSpecification in interface SqlAstWalker
    • visitCastTarget

      public void visitCastTarget(CastTarget castTarget)
      Specified by:
      visitCastTarget in interface SqlAstWalker
    • visitDistinct

      public void visitDistinct(Distinct distinct)
      Specified by:
      visitDistinct in interface SqlAstWalker
    • visitOverflow

      public void visitOverflow(Overflow overflow)
      Specified by:
      visitOverflow in interface SqlAstWalker
    • visitParameter

      public void visitParameter(JdbcParameter jdbcParameter)
      Specified by:
      visitParameter in interface SqlAstWalker
    • visitParameterAsParameter

      protected void visitParameterAsParameter(JdbcParameter jdbcParameter)
    • renderWrappedParameter

      protected void renderWrappedParameter(JdbcParameter jdbcParameter)
    • renderParameterAsParameter

      protected void renderParameterAsParameter(int position, JdbcParameter jdbcParameter)
      Renders a parameter marker for the given position
    • addParameterBinder

      protected final int addParameterBinder(JdbcParameter parameter)
    • addParameterBinder

      protected final int addParameterBinder(JdbcParameter parameter, JdbcParameterBinder parameterBinder)
    • render

      public final void render(SqlAstNode sqlAstNode, SqlAstNodeRenderingMode renderingMode)
      Description copied from interface: SqlAstTranslator
      Render the given SQL AST node using the requested expression mode and the current translator context.
      Specified by:
      render in interface SqlAstTranslator<T extends JdbcOperation>
    • withParameterRenderingMode

      protected void withParameterRenderingMode(SqlAstNodeRenderingMode renderingMode, Runnable runnable)
    • visitTuple

      public void visitTuple(SqlTuple tuple)
      Specified by:
      visitTuple in interface SqlAstWalker
    • renderCommaSeparated

      protected final void renderCommaSeparated(Iterable<? extends SqlAstNode> expressions)
    • renderCommaSeparatedSelectExpression

      protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions)
    • renderCommaSeparatedSelectExpression

      protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions, Iterable<String> aliases)
    • visitCollation

      public void visitCollation(Collation collation)
      Specified by:
      visitCollation in interface SqlAstWalker
    • visitSqlSelectionExpression

      public void visitSqlSelectionExpression(SqlSelectionExpression expression)
      Specified by:
      visitSqlSelectionExpression in interface SqlAstWalker
    • visitEntityTypeLiteral

      public void visitEntityTypeLiteral(EntityTypeLiteral expression)
      Specified by:
      visitEntityTypeLiteral in interface SqlAstWalker
    • visitEmbeddableTypeLiteral

      public void visitEmbeddableTypeLiteral(EmbeddableTypeLiteral expression)
      Specified by:
      visitEmbeddableTypeLiteral in interface SqlAstWalker
    • visitBinaryArithmeticExpression

      public void visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression)
      Specified by:
      visitBinaryArithmeticExpression in interface SqlAstWalker
    • visitArithmeticOperand

      protected void visitArithmeticOperand(Expression expression)
    • visitDuration

      public void visitDuration(Duration duration)
      Specified by:
      visitDuration in interface SqlAstWalker
    • renderInterval

      protected void renderInterval(Duration duration)
    • renderIntervalLiteral

      protected void renderIntervalLiteral(Literal literal, TemporalUnit unit)
    • visitConversion

      public void visitConversion(Conversion conversion)
      Specified by:
      visitConversion in interface SqlAstWalker
    • visitCaseSearchedExpression

      public final void visitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression)
      Specified by:
      visitCaseSearchedExpression in interface SqlAstWalker
    • visitCaseSearchedExpression

      protected void visitCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, boolean inSelect)
    • visitAnsiCaseSearchedExpression

      protected void visitAnsiCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, Consumer<Expression> resultRenderer)
    • visitDecodeCaseSearchedExpression

      protected void visitDecodeCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression)
    • visitCaseSimpleExpression

      public final void visitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression)
      Specified by:
      visitCaseSimpleExpression in interface SqlAstWalker
    • visitCaseSimpleExpression

      protected void visitCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, boolean inSelect)
    • visitAnsiCaseSimpleExpression

      protected void visitAnsiCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, Consumer<Expression> resultRenderer)
    • areAllResultsParameters

      protected boolean areAllResultsParameters(CaseSearchedExpression caseSearchedExpression)
    • areAllResultsParameters

      protected boolean areAllResultsParameters(CaseSimpleExpression caseSimpleExpression)
    • visitAny

      public void visitAny(Any any)
      Specified by:
      visitAny in interface SqlAstWalker
    • visitEvery

      public void visitEvery(Every every)
      Specified by:
      visitEvery in interface SqlAstWalker
    • visitSummarization

      public void visitSummarization(Summarization every)
      Specified by:
      visitSummarization in interface SqlAstWalker
    • visitJdbcLiteral

      public void visitJdbcLiteral(JdbcLiteral<?> jdbcLiteral)
      Specified by:
      visitJdbcLiteral in interface SqlAstWalker
    • visitQueryLiteral

      public void visitQueryLiteral(QueryLiteral<?> queryLiteral)
      Specified by:
      visitQueryLiteral in interface SqlAstWalker
    • visitUnparsedNumericLiteral

      public <N extends Number> void visitUnparsedNumericLiteral(UnparsedNumericLiteral<N> literal)
      Specified by:
      visitUnparsedNumericLiteral in interface SqlAstWalker
    • renderNull

      protected void renderNull(Literal literal)
    • renderAsLiteral

      protected void renderAsLiteral(JdbcParameter jdbcParameter, Object literalValue)
    • visitUnaryOperationExpression

      public void visitUnaryOperationExpression(UnaryOperation unaryOperationExpression)
      Specified by:
      visitUnaryOperationExpression in interface SqlAstWalker
    • visitModifiedSubQueryExpression

      public void visitModifiedSubQueryExpression(ModifiedSubQueryExpression expression)
      Specified by:
      visitModifiedSubQueryExpression in interface SqlAstWalker
    • visitSelfRenderingPredicate

      public void visitSelfRenderingPredicate(SelfRenderingPredicate selfRenderingPredicate)
      Specified by:
      visitSelfRenderingPredicate in interface SqlAstWalker
    • visitSelfRenderingExpression

      public void visitSelfRenderingExpression(SelfRenderingExpression expression)
      Specified by:
      visitSelfRenderingExpression in interface SqlAstWalker
    • visitBooleanExpressionPredicate

      public void visitBooleanExpressionPredicate(BooleanExpressionPredicate booleanExpressionPredicate)
      Specified by:
      visitBooleanExpressionPredicate in interface SqlAstWalker
    • visitBetweenPredicate

      public void visitBetweenPredicate(BetweenPredicate betweenPredicate)
      Specified by:
      visitBetweenPredicate in interface SqlAstWalker
    • visitFilterPredicate

      public void visitFilterPredicate(FilterPredicate filterPredicate)
      Specified by:
      visitFilterPredicate in interface SqlAstWalker
    • visitFilterFragmentPredicate

      public void visitFilterFragmentPredicate(FilterPredicate.FilterFragmentPredicate filter)
      Specified by:
      visitFilterFragmentPredicate in interface SqlAstWalker
    • visitSqlFragmentPredicate

      public void visitSqlFragmentPredicate(SqlFragmentPredicate predicate)
      Specified by:
      visitSqlFragmentPredicate in interface SqlAstWalker
    • visitGroupedPredicate

      public void visitGroupedPredicate(GroupedPredicate groupedPredicate)
      Specified by:
      visitGroupedPredicate in interface SqlAstWalker
    • visitInListPredicate

      public void visitInListPredicate(InListPredicate inListPredicate)
      Specified by:
      visitInListPredicate in interface SqlAstWalker
    • preferUnionQueryForTupleInListPredicate

      protected boolean preferUnionQueryForTupleInListPredicate()
    • renderExpressionsAsValuesSubquery

      protected void renderExpressionsAsValuesSubquery(int tupleSize, List<Expression> listExpressions)
    • visitInArrayPredicate

      public void visitInArrayPredicate(InArrayPredicate inArrayPredicate)
      Specified by:
      visitInArrayPredicate in interface SqlAstWalker
    • visitInSubQueryPredicate

      public void visitInSubQueryPredicate(InSubQueryPredicate inSubQueryPredicate)
      Specified by:
      visitInSubQueryPredicate in interface SqlAstWalker
    • emulateSubQueryRelationalRestrictionPredicate

      protected <X extends Expression> void emulateSubQueryRelationalRestrictionPredicate(Predicate predicate, boolean negated, SelectStatement selectStatement, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator)
    • renderRelationalEmulationSubQuery

      protected <X extends Expression> void renderRelationalEmulationSubQuery(QuerySpec subQuery, X lhsTuple, AbstractSqlAstTranslator.SubQueryRelationalRestrictionEmulationRenderer<X> renderer, ComparisonOperator tupleComparisonOperator)
    • emulateQuantifiedTupleSubQueryPredicate

      protected void emulateQuantifiedTupleSubQueryPredicate(Predicate predicate, SelectStatement selectStatement, SqlTuple lhsTuple, ComparisonOperator tupleComparisonOperator)
      An optimized emulation for relational tuple sub-query comparisons. The idea of this method is to use limit 1 to select the max or min tuple and only compare against that.
    • renderQuantifiedEmulationSubQuery

      protected void renderQuantifiedEmulationSubQuery(QuerySpec subQuery, ComparisonOperator tupleComparisonOperator)
    • renderFetchFirstRow

      protected void renderFetchFirstRow()
    • visitExistsPredicate

      public void visitExistsPredicate(ExistsPredicate existsPredicate)
      Specified by:
      visitExistsPredicate in interface SqlAstWalker
    • visitJunction

      public void visitJunction(Junction junction)
      Specified by:
      visitJunction in interface SqlAstWalker
    • visitLikePredicate

      public void visitLikePredicate(LikePredicate likePredicate)
      Specified by:
      visitLikePredicate in interface SqlAstWalker
    • renderLikePredicate

      protected void renderLikePredicate(LikePredicate likePredicate)
    • renderEscapeCharacter

      protected void renderEscapeCharacter(Expression escapeCharacter)
    • renderCaseInsensitiveLikeEmulation

      protected void renderCaseInsensitiveLikeEmulation(Expression lhs, Expression rhs, Expression escapeCharacter, boolean negated)
    • renderLikePattern

      protected void renderLikePattern(Expression pattern, Expression escapeCharacter)
    • renderBackslashEscapedLikePattern

      protected void renderBackslashEscapedLikePattern(Expression pattern, Expression escapeCharacter, boolean noBackslashEscapes)
    • appendBackslashEscapedLikeLiteral

      protected void appendBackslashEscapedLikeLiteral(SqlAppender appender, String literal, boolean noBackslashEscapes)
    • visitNegatedPredicate

      public void visitNegatedPredicate(NegatedPredicate negatedPredicate)
      Specified by:
      visitNegatedPredicate in interface SqlAstWalker
    • visitNullnessPredicate

      public void visitNullnessPredicate(NullnessPredicate nullnessPredicate)
      Specified by:
      visitNullnessPredicate in interface SqlAstWalker
    • visitThruthnessPredicate

      public void visitThruthnessPredicate(ThruthnessPredicate thruthnessPredicate)
      Specified by:
      visitThruthnessPredicate in interface SqlAstWalker
    • visitRelationalPredicate

      public void visitRelationalPredicate(ComparisonPredicate comparisonPredicate)
      Specified by:
      visitRelationalPredicate in interface SqlAstWalker
    • getSingleRowTableExpression

      protected String getSingleRowTableExpression()
      The reusable single-row table expression supplied by the Dialect.
    • getSelectOnlyFromClause

      protected String getSelectOnlyFromClause()
      The complete optional from fragment for an otherwise table-less select.
    • visitStandardTableInsert

      public final void visitStandardTableInsert(TableInsertStandard tableInsert)
      Specified by:
      visitStandardTableInsert in interface SqlAstWalker
    • renderLegacyReturningInsert

      @SPI(IMPLEMENT) protected boolean renderLegacyReturningInsert(TableInsertStandard tableInsert)
      Temporary escape hatch for the legacy H2 identity-returning path, which renders an additional statement and cannot be expressed as a single returning plan.
      Returns:
      true if this method rendered the complete insert
    • renderStandardTableInsert

      @SPI(IMPLEMENT) protected void renderStandardTableInsert(TableInsertStandard tableInsert)
    • renderInsertInto

      protected void renderInsertInto(TableInsertStandard tableInsert)
    • renderIntoIntoAndTable

      protected void renderIntoIntoAndTable(TableInsertStandard tableInsert)
      Renders the insert into <table name> portion of an insert
    • renderInsertIntoNoColumns

      @SPI(IMPLEMENT) protected void renderInsertIntoNoColumns(TableInsertStandard tableInsert)

      Render a complete insert into statement for an insert with no column value bindings.

      Override this method when the database uses syntax other than the generic values ( ) form. Call renderIntoIntoAndTable(TableInsertStandard) when the standard table rendering and affected-table registration are appropriate, then append the database-specific no-column syntax. If the database cannot express this operation, throw a MappingException which identifies the affected table and Dialect.

      Parameters:
      tableInsert - the supported model insert to render
      Since:
      8.0
    • visitCustomTableInsert

      public void visitCustomTableInsert(TableInsertCustomSql tableInsert)
      Specified by:
      visitCustomTableInsert in interface SqlAstWalker
    • visitStandardTableUpdate

      public final void visitStandardTableUpdate(TableUpdateStandard tableUpdate)
      Specified by:
      visitStandardTableUpdate in interface SqlAstWalker
    • renderStandardTableUpdate

      @SPI(IMPLEMENT) protected void renderStandardTableUpdate(TableUpdateStandard tableUpdate)
    • visitOptionalTableUpdate

      public void visitOptionalTableUpdate(OptionalTableUpdate tableUpdate)
      Specified by:
      visitOptionalTableUpdate in interface SqlAstWalker
    • renderTenantRestriction

      protected final boolean renderTenantRestriction(ColumnValueBinding binding, String qualifier)
      Render an equality restriction whose null parameter denotes a root tenant. Qualify both references when a merge exposes source and target columns.
    • applySqlComment

      protected void applySqlComment(String comment)
    • visitCustomTableUpdate

      public void visitCustomTableUpdate(TableUpdateCustomSql tableUpdate)
      Specified by:
      visitCustomTableUpdate in interface SqlAstWalker
    • visitStandardTableDelete

      public final void visitStandardTableDelete(TableDeleteStandard tableDelete)
      Specified by:
      visitStandardTableDelete in interface SqlAstWalker
    • visitCustomTableDelete

      public void visitCustomTableDelete(TableDeleteCustomSql tableDelete)
      Specified by:
      visitCustomTableDelete in interface SqlAstWalker
    • visitColumnWriteFragment

      public void visitColumnWriteFragment(ColumnWriteFragment columnWriteFragment)
      Specified by:
      visitColumnWriteFragment in interface SqlAstWalker
    • simpleColumnWriteFragmentRendering

      protected void simpleColumnWriteFragmentRendering(ColumnWriteFragment columnWriteFragment)