Top Description Fields Constructors Methods
org.hibernate.dialect

public Class DB2SqlAstTranslator<T extends org.hibernate.sql.exec.spi.JdbcOperation>

extends AbstractSqlAstTranslator<T extends JdbcOperation>
Class Inheritance
Known Direct Subclasses
org.hibernate.dialect.DB2zSqlAstTranslator, org.hibernate.dialect.DB2iSqlAstTranslator
Imports
java.util.List, java.util.function.Consumer, org.hibernate.LockMode, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.metamodel.mapping.JdbcMappingContainer, org.hibernate.query.sqm.ComparisonOperator, .FetchClauseType, org.hibernate.sql.ast.SqlAstNodeRenderingMode, org.hibernate.sql.ast.spi.AbstractSqlAstTranslator, .SqlSelection, org.hibernate.sql.ast.tree.MutationStatement, .Statement, org.hibernate.sql.ast.tree.delete.DeleteStatement, org.hibernate.sql.ast.tree.expression.CaseSearchedExpression, .CaseSimpleExpression, .ColumnReference, .Expression, .Literal, .SqlTuple, .Summarization, org.hibernate.sql.ast.tree.from.QueryPartTableReference, .TableGroup, .TableGroupJoin, .TableReferenceJoin, org.hibernate.sql.ast.tree.insert.InsertSelectStatement, org.hibernate.sql.ast.tree.predicate.BooleanExpressionPredicate, .Predicate, org.hibernate.sql.ast.tree.select.QueryGroup, .QueryPart, .QuerySpec, .SelectStatement, org.hibernate.sql.ast.tree.update.UpdateStatement, org.hibernate.sql.exec.spi.JdbcOperation, org.hibernate.sql.model.internal.TableInsertStandard, org.hibernate.type.SqlTypes

A SQL AST translator for DB2.
Author
Christian Beikov

Field Summary

Modifier and TypeField and Description
private boolean

Constructor Summary

AccessConstructor and Description
public
DB2SqlAstTranslator(SessionFactoryImplementor sessionFactory, Statement statement)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
protected void
public DatabaseVersion
protected String
protected String
protected String
getFromDual()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getFromDual.

Some databases require a bit of syntactic noise when there are no tables in the from clause.
protected String
protected String
protected boolean
needsRecursiveKeywordInWithClause()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.needsRecursiveKeywordInWithClause.

Whether the SQL with clause requires the "recursive" keyword for recursive CTEs.
protected void
protected void
protected void
protected void
protected void
protected void
protected boolean
protected void
protected void
protected void
protected void
protected boolean
protected boolean
protected boolean
protected boolean
supportsRowValueConstructorSyntax()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntax.

Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax.
protected boolean
protected boolean
supportsRowValueConstructorSyntaxInQuantifiedPredicates()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntaxInQuantifiedPredicates.

Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with quantified predicates.
protected boolean
supportsWithClauseInSubquery()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsWithClauseInSubquery.

Whether the SQL with clause is supported within a subquery.
protected void
protected void
public void
protected void
protected void
public void
public void
public void
public void
protected void
public void
public void
protected void
Inherited from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator:
addAdditionalWherePredicateaddAppliedParameterBindingappendappendappendappendBackslashEscapedLikeLiteralappendSqlappendSqlappendSqlappendSqlappendSqlapplyParameterareAllResultsParametersareAllResultsParametersassertRowsOnlyFetchClauseTypecastFunctioncastNumberToStringcleanupdetermineCyclePathColumnNamedetermineLateralEmulationPredicatedetermineLockingStrategydetermineWhereClauseRestrictionWithJoinEmulationemulateCycleClauseWithRowAndArrayemulateFetchOffsetWithWindowFunctionsemulateFetchOffsetWithWindowFunctionsemulateQuantifiedTupleSubQueryPredicateemulateQueryPartTableReferenceColumnAliasingemulateSearchClauseOrderWithRowAndArrayemulateSelectTupleComparisonemulateSortSpecificationNullPrecedenceemulateSubQueryRelationalRestrictionPredicateemulateTupleComparisonemulateValuesTableReferenceColumnAliasinggetAffectedTableNamesgetAppliedParameterBindingsgetArrayContainsFunctiongetBooleanTypegetCastTypeNamegetCastTypeNamegetClauseStackgetCteStatementgetCurrentClauseStackgetCurrentCteStatementgetCurrentDmlStatementgetCurrentQueryPartgetDialectgetDmlTargetTableAliasgetEffectiveLockModegetEffectiveLockModegetEffectiveLockTimeoutgetFetchClauseTypeForRowNumberinggetForUpdateWithClausegetIntegerTypegetJdbcLockStrategygetJdbcParameterBindingsgetJdbcServicesgetLeftHandExpressiongetLimitgetLimitParametergetLockOptionsgetMaxRowsgetNoWaitgetOffsetParametergetParameterBindersgetParameterBindValuegetParameterRenderingModegetQueryPartForRowNumberinggetQueryPartStackgetRowsToSkipgetSelectItemReferencegetSessionFactorygetSortSpecificationsRowNumberinggetSqlgetSqlAppendergetSqlBuffergetSqlTypeNamegetSqlTypeNamegetStatementgetStringTypegetWrapperOptionshasAggregateFunctionshasLimithasLimithasNestedTableGroupsToRenderhasOffsetinlineCteTableGroupinOverOrWithinGroupClauseinterpretExpressionisCorrelatedisInRecursiveQueryPartisLiteralisParameterisRowNumberingCurrentQueryPartisRowsOnlyFetchClauseTypeisStructneedsCteInliningneedsLockingneedsMaxRowsneedsRowsToSkipprepareLimitOffsetParametersprocessNestedTableGroupJoinsprocessTableGroupJoinprocessTableGroupJoinsregisterAffectedTableregisterAffectedTablerenderrenderAsLiteralrenderBackslashEscapedLikePatternrenderCaseInsensitiveLikeEmulationrenderCastedrenderCombinedLimitClauserenderCombinedLimitClauserenderCommaSeparatedrenderCommaSeparatedSelectExpressionrenderCommaSeparatedSelectExpressionrenderComparisonDistinctOperatorrenderComparisonEmulateCaserenderComparisonEmulateDecoderenderComparisonEmulateDecoderenderComparisonEmulateIntersectrenderCteColumnsrenderCycleClauserenderDerivedTableReferencerenderExpressionAsLiteralrenderExpressionsAsSubqueryrenderFetchrenderFetchPlusOffsetExpressionrenderFetchPlusOffsetExpressionAsLiteralrenderFetchPlusOffsetExpressionAsSingleParameterrenderFirstClauserenderFirstClauserenderFirstSkipClauserenderFirstSkipClauserenderForUpdateClauserenderInsertIntoNoColumnsrenderIntoIntoAndTablerenderLimitOffsetClauserenderLimitOffsetClauserenderLiteralrenderMaterializationHintrenderNamedTableReferencerenderOffsetrenderOffsetFetchClauserenderOffsetFetchClauserenderOrderByrenderParameterAsParameterrenderParameterAsParameterrenderPrimaryTableReferencerenderQueryGrouprenderRecursiveCteVirtualSelectionsrenderRootTableGrouprenderRowNumberrenderRowNumberingSelectItemsrenderRowsToClauserenderRowsToClauserenderSearchClauserenderSelectExpressionWithCastedOrInlinedPlainParametersrenderSelectSimpleComparisonrenderSetClauserenderSkipFirstClauserenderSkipFirstClauserendersTableReferenceAliasrenderStandardCycleClauserenderStandardSearchClauserenderStringContainsExactlyPredicaterenderTableGrouprenderTableReferenceIdentificationVariablerenderTopClauserenderTopClauserenderTopStartAtClauserenderTopStartAtClauserenderTupleComparisonStandardrenderVirtualSelectionsresolveAliasedExpressionresolveAliasedExpressionresolveExpressionToAliassetLimitParametersetOffsetParametershouldEmulateLateralWithIntersectshouldInlineCtesimpleColumnWriteFragmentRenderingsupportsArrayConstructorsupportsDistinctFromPredicatesupportsDuplicateSelectItemsInQueryGroupsupportsFilterClausesupportsIntersectsupportsJoinInMutationStatementSubquerysupportsNestedSubqueryCorrelationsupportsNestedWithClausesupportsNullPrecedencesupportsQuantifiedPredicatessupportsRecursiveClauseArrayAndRowEmulationsupportsRecursiveCycleClausesupportsRecursiveCycleUsingClausesupportsRecursiveSearchClausesupportsRowConstructorsupportsRowValueConstructorDistinctFromSyntaxsupportsRowValueConstructorGtLtSyntaxsupportsRowValueConstructorSyntaxInInSubQuerysupportsRowValueConstructorSyntaxInSetsupportsSimpleQueryGroupingsupportsWithClausetranslatetranslateDeletetranslateInserttranslateSelecttranslateUpdateuseOffsetFetchClausevisitAggregateColumnWriteExpressionvisitAnyvisitAssignmentvisitBetweenPredicatevisitBinaryArithmeticExpressionvisitCaseSearchedExpressionvisitCaseSearchedExpressionvisitCaseSimpleExpressionvisitCaseSimpleExpressionvisitCastTargetvisitCollationvisitColumnReferencevisitColumnWriteFragmentvisitConversionvisitCteContainervisitCteDefinitionvisitCteObjectvisitCustomTableDeletevisitCustomTableInsertvisitCustomTableUpdatevisitDecodeCaseSearchedExpressionvisitDeleteStatementvisitDistinctvisitDurationvisitDurationUnitvisitEntityTypeLiteralvisitEveryvisitExistsPredicatevisitExtractUnitvisitFilterFragmentPredicatevisitFilterPredicatevisitFormatvisitForUpdateClausevisitFromClausevisitFunctionTableReferencevisitGroupByClausevisitGroupedPredicatevisitHavingClausevisitInArrayPredicatevisitInListPredicatevisitInsertStatementvisitInSubQueryPredicatevisitJdbcLiteralvisitJunctionvisitLikePredicatevisitModifiedSubQueryExpressionvisitNamedTableReferencevisitNegatedPredicatevisitNullnessPredicatevisitOptionalTableUpdatevisitOrderByvisitOvervisitOverClausevisitOverClausevisitOverflowvisitParametervisitParameterAsParametervisitPartitionByClausevisitPartitionExpressionsvisitPartitionExpressionsvisitQueryLiteralvisitRecursivePathvisitRelationalPredicatevisitReturningColumnsvisitSelectClausevisitSelfRenderingExpressionvisitSelfRenderingPredicatevisitSetAssignmentvisitSortSpecificationvisitSortSpecificationvisitSqlFragmentPredicatevisitSqlSelectExpressionvisitSqlSelectionvisitSqlSelectionExpressionvisitSqlSelectionsvisitStandardTableDeletevisitStandardTableUpdatevisitStarvisitSummarizationvisitTableGroupvisitTableGroupJoinvisitTableReferenceJoinvisitThruthnessPredicatevisitTrimSpecificationvisitTuplevisitUnaryOperationExpressionvisitUnparsedNumericLiteralvisitUpdateStatementvisitValuesListvisitValuesListEmulateSelectUnionvisitValuesListStandardvisitValuesTableReferencevisitWhereClausewithParameterRenderingModewithRowNumbering

Field Detail

inLateralback to summary
private boolean inLateral

Constructor Detail

DB2SqlAstTranslatorback to summary
public DB2SqlAstTranslator(SessionFactoryImplementor sessionFactory, Statement statement)

Deprecated

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

Method Detail

emulateFetchOffsetWithWindowFunctionsVisitQueryPartback to summary
protected void emulateFetchOffsetWithWindowFunctionsVisitQueryPart(QueryPart queryPart)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.emulateFetchOffsetWithWindowFunctionsVisitQueryPart.

Annotations
@Override
getDB2Versionback to summary
public DatabaseVersion getDB2Version()
getForShareback to summary
protected String getForShare(int timeoutMillis)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getForShare.

Annotations
@Override
getForUpdateback to summary
protected String getForUpdate()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getForUpdate.

Annotations
@Override
getFromDualback to summary
protected String getFromDual()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getFromDual.

Doc from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getFromDual.

Some databases require a bit of syntactic noise when there are no tables in the from clause.

Returns:String

the SQL equivalent to Oracle's from dual.

Annotations
@Override
getFromDualForSelectOnlyback to summary
protected String getFromDualForSelectOnly()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getFromDualForSelectOnly.

Annotations
@Override
getSkipLockedback to summary
protected String getSkipLocked()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.getSkipLocked.

Annotations
@Override
needsRecursiveKeywordInWithClauseback to summary
protected boolean needsRecursiveKeywordInWithClause()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.needsRecursiveKeywordInWithClause.

Doc from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.needsRecursiveKeywordInWithClause.

Whether the SQL with clause requires the "recursive" keyword for recursive CTEs.

Annotations
@Override
renderComparisonback to summary
protected void renderComparison(Expression lhs, ComparisonOperator operator, Expression rhs)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderComparison.

Annotations
@Override
renderComparisonStandardback to summary
protected void renderComparisonStandard(Expression lhs, ComparisonOperator operator, Expression rhs)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderComparisonStandard.

Annotations
@Override
renderExpressionAsClauseItemback to summary
protected void renderExpressionAsClauseItem(Expression expression)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderExpressionAsClauseItem.

Annotations
@Override
renderFetchExpressionback to summary
protected void renderFetchExpression(Expression fetchExpression)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderFetchExpression.

Annotations
@Override
renderOffsetExpressionback to summary
protected void renderOffsetExpression(Expression offsetExpression)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderOffsetExpression.

Annotations
@Override
renderPartitionItemback to summary
protected void renderPartitionItem(Expression expression)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderPartitionItem.

Annotations
@Override
renderReturningClauseback to summary
protected boolean renderReturningClause(MutationStatement statement)
renderSelectExpressionback to summary
protected void renderSelectExpression(Expression expression)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderSelectExpression.

Annotations
@Override
renderSelectTupleComparisonback to summary
protected void renderSelectTupleComparison(List<SqlSelection> lhsExpressions, SqlTuple tuple, ComparisonOperator operator)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderSelectTupleComparison.

Annotations
@Override
renderTableGroupJoinback to summary
protected void renderTableGroupJoin(TableGroupJoin tableGroupJoin, List<TableGroupJoin> tableGroupJoinCollector)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderTableGroupJoin.

Annotations
@Override
renderTableReferenceJoinsback to summary
protected void renderTableReferenceJoins(TableGroup tableGroup)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderTableReferenceJoins.

Annotations
@Override
shouldEmulateFetchClauseback to summary
protected boolean shouldEmulateFetchClause(QueryPart queryPart)
supportsOffsetClauseback to summary
protected boolean supportsOffsetClause()
supportsParameterOffsetFetchExpressionback to summary
protected boolean supportsParameterOffsetFetchExpression()
supportsRowValueConstructorSyntaxback to summary
protected boolean supportsRowValueConstructorSyntax()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntax.

Doc from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntax.

Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax.

Basically, does it support syntax like ... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...

Returns:boolean

True if this SQL dialect is known to support "row value constructor" syntax; false otherwise.

Annotations
@Override
supportsRowValueConstructorSyntaxInInListback to summary
protected boolean supportsRowValueConstructorSyntaxInInList()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntaxInInList.

Doc from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntaxInInList.

If the dialect supports row values, does it offer such support in IN lists as well?

For example, ... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ...

Returns:boolean

True if this SQL dialect is known to support "row value constructor" syntax in the IN list; false otherwise.

Annotations
@Override
supportsRowValueConstructorSyntaxInQuantifiedPredicatesback to summary
protected boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntaxInQuantifiedPredicates.

Doc from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsRowValueConstructorSyntaxInQuantifiedPredicates.

Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with quantified predicates.

Basically, does it support syntax like ... where (FIRST_NAME, LAST_NAME) = ALL (select ...) ...

Returns:boolean

True if this SQL dialect is known to support "row value constructor" syntax with quantified predicates; false otherwise.

Annotations
@Override
supportsWithClauseInSubqueryback to summary
protected boolean supportsWithClauseInSubquery()

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsWithClauseInSubquery.

Doc from org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.supportsWithClauseInSubquery.

Whether the SQL with clause is supported within a subquery.

Annotations
@Override
visitAnsiCaseSearchedExpressionback to summary
protected void visitAnsiCaseSearchedExpression(CaseSearchedExpression caseSearchedExpression, Consumer<Expression> resultRenderer)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitAnsiCaseSearchedExpression.

Annotations
@Override
visitAnsiCaseSimpleExpressionback to summary
protected void visitAnsiCaseSimpleExpression(CaseSimpleExpression caseSimpleExpression, Consumer<Expression> resultRenderer)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitAnsiCaseSimpleExpression.

Annotations
@Override
visitBooleanExpressionPredicateback to summary
public void visitBooleanExpressionPredicate(BooleanExpressionPredicate booleanExpressionPredicate)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitBooleanExpressionPredicate.

Implements org.hibernate.sql.ast.SqlAstWalker.visitBooleanExpressionPredicate.

Annotations
@Override
visitDeleteStatementOnlyback to summary
protected void visitDeleteStatementOnly(DeleteStatement statement)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitDeleteStatementOnly.

Annotations
@Override
visitInsertStatementOnlyback to summary
protected void visitInsertStatementOnly(InsertSelectStatement statement)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitInsertStatementOnly.

Annotations
@Override
visitOffsetFetchClauseback to summary
public void visitOffsetFetchClause(QueryPart queryPart)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitOffsetFetchClause.

Implements org.hibernate.sql.ast.SqlAstWalker.visitOffsetFetchClause.

Annotations
@Override
visitQueryGroupback to summary
public void visitQueryGroup(QueryGroup queryGroup)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitQueryGroup.

Implements org.hibernate.sql.ast.SqlAstWalker.visitQueryGroup.

Annotations
@Override
visitQueryPartTableReferenceback to summary
public void visitQueryPartTableReference(QueryPartTableReference tableReference)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitQueryPartTableReference.

Implements org.hibernate.sql.ast.SqlAstWalker.visitQueryPartTableReference.

Annotations
@Override
visitQuerySpecback to summary
public void visitQuerySpec(QuerySpec querySpec)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitQuerySpec.

Implements org.hibernate.sql.ast.SqlAstWalker.visitQuerySpec.

Annotations
@Override
visitReturningColumnsback to summary
protected void visitReturningColumns(List<ColumnReference> returningColumns)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitReturningColumns.

Annotations
@Override
visitSelectStatementback to summary
public void visitSelectStatement(SelectStatement statement)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitSelectStatement.

Implements org.hibernate.sql.ast.SqlAstWalker.visitSelectStatement.

Annotations
@Override
visitStandardTableInsertback to summary
public void visitStandardTableInsert(TableInsertStandard tableInsert)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitStandardTableInsert.

Implements org.hibernate.sql.ast.SqlAstWalker.visitStandardTableInsert.

Annotations
@Override
visitUpdateStatementOnlyback to summary
protected void visitUpdateStatementOnly(UpdateStatement statement)

Overrides org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitUpdateStatementOnly.

Annotations
@Override