Class KeycloakOracleDialect

java.lang.Object
org.hibernate.dialect.Dialect
org.hibernate.dialect.OracleDialect
org.keycloak.connections.jpa.dialect.KeycloakOracleDialect
All Implemented Interfaces:
org.hibernate.boot.model.FunctionContributor, org.hibernate.boot.model.TypeContributor, org.hibernate.exception.spi.ConversionContext

public class KeycloakOracleDialect extends org.hibernate.dialect.OracleDialect
Fixes Hibernate's Oracle dialect to correctly handle HQL insert ... on conflict (...) do nothing, which it would otherwise render as a plain INSERT that silently drops the conflict clause.

It renders an INSERT with the IGNORE_ROW_ON_DUPKEY_INDEX hint, so that a duplicate key is skipped and counted as 0 rows. Unlike a MERGE, this also holds when a concurrent transaction inserts the same key. The conflict columns must match a unique index. do update clauses are still rendered as MERGE, which fails with a unique constraint violation in that case.

See HHH-20826 for the upstream tracker.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect

    org.hibernate.dialect.Dialect.SizeStrategy, org.hibernate.dialect.Dialect.SizeStrategyImpl
  • Field Summary

    Fields inherited from class org.hibernate.dialect.OracleDialect

    applicationContinuity, autonomous, driverMajorVersion, driverMinorVersion, extended

    Fields inherited from class org.hibernate.dialect.Dialect

    CLOSED_QUOTE, FALSE_STRING_VALUES, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY, TRUE_STRING_VALUES
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    KeycloakOracleDialect(org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo info)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.hibernate.sql.ast.SqlAstTranslatorFactory
     

    Methods inherited from class org.hibernate.dialect.OracleDialect

    appendBinaryLiteral, appendBooleanValueString, appendCheckConstraintOptions, appendDatetimeFormat, appendDateTimeLiteral, buildIdentifierHelper, buildSQLExceptionConversionDelegate, canCreateSchema, canDisableConstraints, castPattern, columnType, contributeTypes, createOptionalTableUpdateOperation, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestamp, currentTimestampWithTimeZone, datetimeFormat, dropConstraints, extractPattern, forceLobAsLastValue, generatedAs, getAddColumnString, getAggregateSupport, getAlterColumnTypeString, getArrayTypeName, getCallableStatementSupport, getCascadeConstraintsString, getCreateEnumTypeCommand, getCreateUserDefinedTypeKindString, getCreateVarcharEnumTypeCommand, getCurrentSchemaCommand, getCurrentTimestampSelectString, getDefaultStatementBatchSize, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintStatement, getDmlTargetColumnQualifierSupport, getDriverMajorVersion, getDriverMinorVersion, getDropEnumTypeCommand, getDual, getEnableConstraintStatement, getEnumTypeDeclaration, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getFractionalSecondPrecisionInNanos, getFromDualForSelectOnly, getGlobalTemporaryTableStrategy, getGroupBySelectItemReferenceStrategy, getIdentityColumnSupport, getInExpressionCountLimit, getInformationExtractor, getLimitHandler, getLocalTemporaryTableStrategy, getLockingSupport, getMaxAliasLength, getMaxIdentifierLength, getMaximumSeriesSize, getMaxTimestampPrecision, getMaxVarbinaryLength, getMaxVarcharLength, getMinimumSupportedVersion, getNativeValueGenerationStrategy, getPreferredSqlTypeCodeForArray, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getQueryHintString, getQuerySequencesString, getReadLockString, getReadLockString, getReadLockString, getReadLockString, getResultSet, getResultSet, getResultSet, getSelectGUIDString, getSequenceInformationExtractor, getSequenceSupport, getSupportedTemporaryTableKind, getTableExporter, getTemporalTableSupport, getTemporaryTableCreateOptions, getTimeZoneSupport, getUniqueDelegate, getUserDefinedTypeExporter, getValueLOBFragmentForExtraCreateTableInfo, getViolatedConstraintNameExtractor, getWriteLockString, getWriteLockString, getWriteLockString, getWriteLockString, initializeFunctionRegistry, isApplicationContinuity, isAutonomous, isCurrentTimestampSelectStringCallable, isEmptyStringTreatedAsNull, isExtended, registerArrayFunctions, registerColumnTypes, registerJsonFunctions, registerResultSetOutParameter, registerResultSetOutParameter, registerXmlFunctions, resolveSqlTypeDescriptor, rowId, supportsAlterColumnType, supportsBitType, supportsCommentOn, supportsCurrentTimestampSelection, supportsDuplicateSelectItemsInQueryGroup, supportsExistsInSelect, supportsFetchClause, supportsFromClauseInUpdate, supportsIfExistsAfterAlterTable, supportsIfExistsBeforeIndexName, supportsIfExistsBeforeTableName, supportsIfExistsBeforeTypeName, supportsInsertReturningGeneratedKeys, supportsLateral, supportsNestedSubqueryCorrelation, supportsOffsetInSubquery, supportsPartitionBy, supportsRecursiveCTE, supportsRecursiveCycleClause, supportsRecursiveSearchClause, supportsRowValueConstructorSyntax, supportsRowValueConstructorSyntaxInQuantifiedPredicates, supportsSimpleQueryGrouping, supportsTemporalLiteralOffset, supportsTupleDistinctCounts, supportsUserDefinedTypes, supportsValueLOBAccess, supportsValuesList, supportsWindowFunctions, supportsWithClauseInSubquery, throttleDdl, timestampaddPattern, timestampdiffPattern, useFollowOnLocking, useInputStreamToInsertBlob

    Methods inherited from class org.hibernate.dialect.Dialect

    addPartitionKeyToPrimaryKey, addSqlHintOrComment, addUseIndexQueryHint, appendArrayLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendIntervalLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildLockingClauseStrategy, buildOptimisticForceIncrementStrategy, buildOptimisticStrategy, buildPessimisticForceIncrementStrategy, buildPessimisticReadStrategy, buildPessimisticWriteStrategy, buildReadStrategy, buildStringToBooleanCast, buildStringToBooleanCastDecode, buildStringToBooleanDecode, canBatchTruncate, canCreateCatalog, castType, causesRollback, checkVersion, closeQuote, contribute, contributeFunctions, defaultScrollMode, determineDatabaseVersion, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, doesRoundTemporalOnOverflow, equivalentTypes, escapeComment, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getBeforeDropStatement, getCaseInsensitiveLike, getCatalogSeparator, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckConstraintString, getColumnAliasExtractor, getColumnComment, getColumnDefaultString, getCreateCatalogCommand, getCreateEnumTypeCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getCrossReferenceParentTableFilter, getDefaultDecimalPrecision, getDefaultIntervalSecondScale, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultOrdinalityColumnName, getDefaultProperties, getDisableConstraintsStatement, getDoublePrecision, getDropCatalogCommand, getDropEnumTypeCommand, getDropForeignKeyString, getDropSchemaCommand, getDropTableString, getDropUniqueKeyString, getEnableConstraintsStatement, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFloatPrecision, getForeignKeyExporter, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFunctionalDependencyAnalysisSupport, getHqlTranslator, getIndexExporter, getKeywords, getLobMergeStrategy, getLockingClauseStrategy, getLockingStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarcharCapacity, getMultiKeyLoadSizingStrategy, getNameQualifierSupport, getNationalizationSupport, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNoColumnsInsertString, getNullColumnString, getNullColumnString, getNullOrdering, getParameterCountLimit, getPersistentTemporaryTableStrategy, getPessimisticLockStyle, getReadRowLockStrategy, getRowIdColumnString, getSchemaNameResolver, getSelectClauseNullString, getSelectClauseNullString, getSequenceExporter, getSetOperatorSqlString, getSizeStrategy, getSqmTranslatorFactory, getTableCleaner, getTableComment, getTableMigrator, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTruncateTableStatement, getTruncateTableStatements, getUniqueKeyExporter, getVersion, getWriteRowLockStrategy, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, isCurrentTimestampStable, isJdbcLogWarningsEnabledByDefault, isLob, narrowCastType, openQuote, ordinal, prependComment, qualifyIndexName, quote, quoteCollation, registerDefaultKeywords, registerKeyword, registerKeywords, requiresCastForConcatenatingNonStrings, requiresColumnListInCreateView, requiresFloatCastingOfIntegerDivision, requiresNotNullBeforeDefault, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeLength, roundsToMaxPrecisionFirst, rowIdSqlType, stripsTrailingSpacesFromChar, supportsArrayConstructor, supportsBatchUpdates, supportsBindAsCallableArgument, supportsBindingNullForSetObject, supportsBindingNullSqlTypeForSetNull, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsConflictClauseForInsertCTE, supportsCrossJoin, supportsCteHeaderColumnList, supportsDistinctFromPredicate, supportsExceptAll, supportsExpectedLobUsagePattern, supportsFilterClause, supportsForUpdate, supportsFractionalTimestampArithmetic, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsInsertReturning, supportsInsertReturningRowId, supportsIntersect, supportsIsTrue, supportsJdbcConnectionLobCreation, supportsJoinInMutationStatementSubquery, supportsJoinsInDelete, supportsLobValueChangePropagation, supportsLockTimeouts, supportsMaterializedLobAccess, supportsNamedColumnCheck, supportsNamedParameters, supportsNationalizedMethods, supportsNestedWithClause, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsNotNullAfterGeneratedAs, supportsNoWait, supportsNullPrecedence, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsPredicateAsExpression, supportsRecursiveCycleUsingClause, supportsRefCursors, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowConstructor, supportsRowValueConstructorDistinctFromSyntax, supportsRowValueConstructorGtLtSyntax, supportsRowValueConstructorSyntaxInInList, supportsRowValueConstructorSyntaxInInSubQuery, supportsSkipLocked, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTableOptions, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsUniqueConstraints, supportsUpdateReturning, supportsValuesListForInsert, supportsWait, supportsWithClause, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, translateExtractField, trimPattern, unquoteGetGeneratedKeys, useArrayForMultiValuedParameters, useConnectionToCreateLob, useCrossReferenceForeignKeys, useMaterializedLobWhenCapacityExceeded

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • KeycloakOracleDialect

      public KeycloakOracleDialect()
    • KeycloakOracleDialect

      public KeycloakOracleDialect(org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo info)
  • Method Details

    • getSqlAstTranslatorFactory

      public org.hibernate.sql.ast.SqlAstTranslatorFactory getSqlAstTranslatorFactory()
      Overrides:
      getSqlAstTranslatorFactory in class org.hibernate.dialect.OracleDialect