Package org.hibernate.dialect
Class DB2iDialect
java.lang.Object
org.hibernate.dialect.Dialect
org.hibernate.dialect.DB2Dialect
org.hibernate.dialect.DB2iDialect
- All Implemented Interfaces:
FunctionContributor,TypeContributor,ConversionContext
A SQL dialect for DB2 for IBM i version 7.2 and above, previously known as "DB2/400".
-
Nested Class Summary
Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl -
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected LockingSupportgetCreateIndexString(boolean unique) The command used to create an index, usuallycreate indexorcreate unique index.getCreateIndexTail(boolean unique, List<Column> columns) A string to be appended to the end of thecreate indexcommand, usually to specify thatnullvalues are to be considered distinct.DB2 LUW VersionRetrieves theFOR UPDATE SKIP LOCKEDsyntax specific to this dialect.getForUpdateSkipLockedString(String aliases) Get theFOR UPDATE OF column_list SKIP LOCKEDfragment appropriate for this dialect, given the aliases of the columns to be write locked.Get the string to append toSELECTstatements to acquire pessimistic UPGRADE locks for this dialect.Get the appropriateIdentityColumnSupportfor this dialect.Obtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).protected DatabaseVersionGet the version of the SQL dialect that is the minimum supported by this implementation.Get theselectcommand used retrieve the names of all sequences.getReadLockString(int timeout) Get the string to append toSELECTstatements to acquire READ locks for this dialect.getReadLockString(Timeout timeout) Get the string to append toSELECTstatements to acquire READ locks for this dialect.getRowIdColumnString(String rowId) If this dialect requires that therowidcolumn be declared explicitly, return the DDL column definition.No support for sequences.getWriteLockString(int timeout) Get the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.getWriteLockString(Timeout timeout) Get the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.voidinitializeFunctionRegistry(FunctionContributions functionContributions) Initialize the given registry with any dialect-specific functions.The more "standard" syntax isrid_bit(alias)but here we usealias.rowid.intThe JDBC type code of therowid-like pseudo-column which acts as a high-performance row locator.booleanFor dropping a table, can the phraseif existsbe applied before the table name?booleanDoes this dialect fully support returning arbitrary generated column values after execution of anupdatestatement, using native SQL syntax?Methods inherited from class org.hibernate.dialect.DB2Dialect
appendBinaryLiteral, appendBooleanValueString, appendDatetimeFormat, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, buildIdentifierHelper, buildSQLExceptionConversionDelegate, canDisableConstraints, castPattern, columnType, contributeTypes, createOptionalTableUpdateOperation, createUniqueDelegate, doesReadCommittedCauseWritersToBlockReaders, doesRoundTemporalOnOverflow, dropConstraints, extractPattern, generatedAs, getAggregateSupport, getAlterColumnTypeString, getCallableStatementSupport, getCreateUserDefinedTypeExtensionsString, getCurrentTimestampSelectString, getDefaultDecimalPrecision, getDefaultStatementBatchSize, getDisableConstraintStatement, getDmlTargetColumnQualifierSupport, getDropSchemaCommand, getDual, getEnableConstraintStatement, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getFractionalSecondPrecisionInNanos, getFromDualForSelectOnly, getGlobalTemporaryTableStrategy, getInExpressionCountLimit, getLockingSupport, getMaxIdentifierLength, getMaximumSeriesSize, getMaxVarcharLength, getPreferredSqlTypeCodeForArray, getResultSet, getResultSet, getResultSet, getSelectClauseNullString, getSequenceInformationExtractor, getTableExporter, getTruncateTableStatement, getUniqueDelegate, getViolatedConstraintNameExtractor, isCurrentTimestampSelectStringCallable, registerColumnTypes, registerResultSetOutParameter, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, selectNullString, supportsAlterColumnType, supportsCommentOn, supportsCurrentTimestampSelection, supportsDistinctFromPredicate, supportsExistsInSelect, supportsFromClauseInUpdate, supportsInsertReturning, supportsInsertReturningRowId, supportsIsTrue, supportsLateral, supportsLobValueChangePropagation, supportsNationalizedMethods, supportsNonQueryWithCTE, supportsNullPrecedence, supportsOffsetInSubquery, supportsPartitionBy, supportsRecursiveCTE, supportsRefCursors, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowValueConstructorSyntax, supportsRowValueConstructorSyntaxInInList, supportsRowValueConstructorSyntaxInInSubQuery, supportsRowValueConstructorSyntaxInQuantifiedPredicates, supportsTupleDistinctCounts, supportsUserDefinedTypes, supportsValuesList, supportsWindowFunctions, supportsWithClauseInSubquery, timestampaddPattern, timestampdiffPattern, translateExtractField, useConnectionToCreateLobMethods inherited from class org.hibernate.dialect.Dialect
addPartitionKeyToPrimaryKey, addSqlHintOrComment, addUseIndexQueryHint, appendArrayLiteral, appendCheckConstraintOptions, appendIntervalLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildLockingClauseStrategy, buildOptimisticForceIncrementStrategy, buildOptimisticStrategy, buildPessimisticForceIncrementStrategy, buildPessimisticReadStrategy, buildPessimisticWriteStrategy, buildReadStrategy, buildStringToBooleanCast, buildStringToBooleanCastDecode, buildStringToBooleanDecode, canBatchTruncate, canCreateCatalog, canCreateSchema, castType, checkVersion, closeQuote, contribute, contributeFunctions, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestamp, currentTimestampWithTimeZone, defaultScrollMode, determineDatabaseVersion, doesRepeatableReadCauseReadersToBlockWriters, equivalentTypes, escapeComment, forceLobAsLastValue, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getBeforeDropStatement, getCascadeConstraintsString, getCaseInsensitiveLike, getCatalogSeparator, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckConstraintString, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateEnumTypeCommand, getCreateEnumTypeCommand, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeKindString, getCrossReferenceParentTableFilter, getCurrentSchemaCommand, getDefaultIntervalSecondScale, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultOrdinalityColumnName, getDefaultProperties, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintsStatement, getDoublePrecision, getDropCatalogCommand, getDropEnumTypeCommand, getDropEnumTypeCommand, getDropForeignKeyString, getDropTableString, getDropUniqueKeyString, getEnableConstraintsStatement, getEnumTypeDeclaration, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFloatPrecision, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFunctionalDependencyAnalysisSupport, getGroupBySelectItemReferenceStrategy, getHqlTranslator, getIndexExporter, getKeywords, getLobMergeStrategy, getLocalTemporaryTableStrategy, getLockingClauseStrategy, getLockingStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarbinaryLength, getMaxVarcharCapacity, getMultiKeyLoadSizingStrategy, getNameQualifierSupport, getNationalizationSupport, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNativeValueGenerationStrategy, getNoColumnsInsertString, getNullColumnString, getNullColumnString, getNullOrdering, getParameterCountLimit, getPersistentTemporaryTableStrategy, getPessimisticLockStyle, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getQueryHintString, getReadLockString, getReadLockString, getReadRowLockStrategy, getSchemaNameResolver, getSelectClauseNullString, getSelectGUIDString, getSequenceExporter, getSizeStrategy, getSqmTranslatorFactory, getSupportedTemporaryTableKind, getTableCleaner, getTableComment, getTableMigrator, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTimeZoneSupport, getTruncateTableStatements, getUniqueKeyExporter, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, getWriteLockString, getWriteLockString, getWriteRowLockStrategy, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, isEmptyStringTreatedAsNull, isJdbcLogWarningsEnabledByDefault, isLob, openQuote, ordinal, prependComment, qualifyIndexName, quote, quoteCollation, registerDefaultKeywords, registerKeyword, registerKeywords, requiresColumnListInCreateView, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeDescriptor, resolveSqlTypeLength, stripsTrailingSpacesFromChar, supportsArrayConstructor, supportsBatchUpdates, supportsBindAsCallableArgument, supportsBindingNullForSetObject, supportsBindingNullSqlTypeForSetNull, supportsBitType, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsConflictClauseForInsertCTE, supportsCrossJoin, supportsDuplicateSelectItemsInQueryGroup, supportsExpectedLobUsagePattern, supportsFetchClause, supportsFilterClause, supportsForUpdate, supportsFractionalTimestampArithmetic, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTypeName, supportsInsertReturningGeneratedKeys, supportsIntersect, supportsJdbcConnectionLobCreation, supportsJoinInMutationStatementSubquery, supportsJoinsInDelete, supportsLockTimeouts, supportsMaterializedLobAccess, supportsNamedColumnCheck, supportsNamedParameters, supportsNestedSubqueryCorrelation, supportsNestedWithClause, supportsNoColumnsInsert, supportsNoWait, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsPredicateAsExpression, supportsRecursiveCycleClause, supportsRecursiveCycleUsingClause, supportsRecursiveSearchClause, supportsRowConstructor, supportsRowValueConstructorDistinctFromSyntax, supportsRowValueConstructorGtLtSyntax, supportsSimpleQueryGrouping, supportsSkipLocked, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTableOptions, supportsTemporalLiteralOffset, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsValuesListForInsert, supportsWait, supportsWithClause, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, trimPattern, unquoteGetGeneratedKeys, useArrayForMultiValuedParameters, useCrossReferenceForeignKeys, useFollowOnLocking, useInputStreamToInsertBlob, useMaterializedLobWhenCapacityExceeded
-
Field Details
-
DB2_LUW_VERSION
-
-
Constructor Details
-
DB2iDialect
-
DB2iDialect
public DB2iDialect() -
DB2iDialect
-
-
Method Details
-
buildLockingSupport
- Overrides:
buildLockingSupportin classDB2Dialect
-
initializeFunctionRegistry
Description copied from class:DialectInitialize the given registry with any dialect-specific functions.Support for certain SQL functions is required, and if the database does not support a required function, then the dialect must define a way to emulate it.
These required functions include the functions defined by the JPA query language specification:
-
avg(arg)- aggregate function -
count([distinct ]arg)- aggregate function -
max(arg)- aggregate function -
min(arg)- aggregate function -
sum(arg)- aggregate function
-
coalesce(arg0, arg1, ...) -
nullif(arg0, arg1)
-
lower(arg) -
upper(arg) -
length(arg) -
concat(arg0, arg1, ...) -
locate(pattern, string[, start]) -
substring(string, start[, length]) -
trim([[spec ][character ]from] string)
-
abs(arg) -
mod(arg0, arg1) -
sqrt(arg)
-
current date -
current time -
current timestamp
-
any(arg)- aggregate function -
every(arg)- aggregate function
-
var_samp(arg)- aggregate function -
var_pop(arg)- aggregate function -
stddev_samp(arg)- aggregate function -
stddev_pop(arg)- aggregate function
-
cast(arg as Type) -
extract(field from arg)
-
ln(arg) -
exp(arg) -
power(arg0, arg1) -
floor(arg) -
ceiling(arg)
-
position(pattern in string) -
substring(string from start[ for length]) -
overlay(string placing replacement from start[ for length])
java.timetypes:-
local date -
local time -
local datetime -
offset datetime -
instant
-
left(string, length) -
right(string, length) -
replace(string, pattern, replacement) -
pad(string with length spec[ character]) -
repeat(string, times)
-
pi -
log10(arg) -
log(base, arg) -
sign(arg) -
sin(arg) -
cos(arg) -
tan(arg) -
asin(arg) -
acos(arg) -
atan(arg) -
atan2(arg0, arg1) -
round(arg0[, arg1]) -
truncate(arg0[, arg1]) -
sinh(arg) -
tanh(arg) -
cosh(arg) -
least(arg0, arg1, ...) -
greatest(arg0, arg1, ...) -
degrees(arg) -
radians(arg) -
bitand(arg1, arg1) -
bitor(arg1, arg1) -
bitxor(arg1, arg1)
-
format(datetime as pattern) -
collate(string as collation) -
str(arg)- synonym ofcast(a as String) -
ifnull(arg0, arg1)- synonym ofcoalesce(a, b)
-
ordinal(arg) -
string(arg)
extract(), and desugared by the parser:-
second(arg)- synonym ofextract(second from a) -
minute(arg)- synonym ofextract(minute from a) -
hour(arg)- synonym ofextract(hour from a) -
day(arg)- synonym ofextract(day from a) -
month(arg)- synonym ofextract(month from a) -
year(arg)- synonym ofextract(year from a)
second()function returns a floating point value, contrary to the integer type returned by the native function with this name on many databases. Thus, we don't just naively map these HQL functions to the native SQL functions with the same names.- Overrides:
initializeFunctionRegistryin classDB2Dialect
-
-
getMinimumSupportedVersion
Description copied from class:DialectGet the version of the SQL dialect that is the minimum supported by this implementation.- Overrides:
getMinimumSupportedVersionin classDB2Dialect
-
getDB2Version
Description copied from class:DB2DialectDB2 LUW Version- Overrides:
getDB2Versionin classDB2Dialect
-
getCreateIndexString
Description copied from class:DialectThe command used to create an index, usuallycreate indexorcreate unique index.- Overrides:
getCreateIndexStringin classDialect- Parameters:
unique-trueif the index is a unique index- Returns:
- The command used to create an index.
-
getCreateIndexTail
Description copied from class:DialectA string to be appended to the end of thecreate indexcommand, usually to specify thatnullvalues are to be considered distinct.- Overrides:
getCreateIndexTailin classDB2Dialect
-
supportsIfExistsBeforeTableName
public boolean supportsIfExistsBeforeTableName()Description copied from class:DialectFor dropping a table, can the phraseif existsbe applied before the table name?- Overrides:
supportsIfExistsBeforeTableNamein classDB2Dialect- Returns:
trueifif existscan be applied before the table name
-
supportsUpdateReturning
public boolean supportsUpdateReturning()Description copied from class:DialectDoes this dialect fully support returning arbitrary generated column values after execution of anupdatestatement, using native SQL syntax?Defaults to the value of
Dialect.supportsInsertReturning()but can be overridden to explicitly disable this for updates.- Overrides:
supportsUpdateReturningin classDialect- See Also:
-
getSequenceSupport
No support for sequences.- Overrides:
getSequenceSupportin classDB2Dialect
-
getQuerySequencesString
Description copied from class:DialectGet theselectcommand used retrieve the names of all sequences.- Overrides:
getQuerySequencesStringin classDB2Dialect- Returns:
- The select command; or null if sequences are not supported.
-
getLimitHandler
Description copied from class:DialectObtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).- Overrides:
getLimitHandlerin classDB2Dialect
-
getIdentityColumnSupport
Description copied from class:DialectGet the appropriateIdentityColumnSupportfor this dialect.- Overrides:
getIdentityColumnSupportin classDB2Dialect- Returns:
- the IdentityColumnSupport
-
getSqlAstTranslatorFactory
Description copied from class:Dialect- Overrides:
getSqlAstTranslatorFactoryin classDB2Dialect- See Also:
-
rowId
Description copied from class:DB2DialectThe more "standard" syntax isrid_bit(alias)but here we usealias.rowid.There is also an alternative
rid()of typebigint, but it cannot be used with partitioning.- Overrides:
rowIdin classDB2Dialect- Parameters:
rowId- the name specified byRowId.value(), which is ignored ifDialect.getRowIdColumnString(java.lang.String)is not overridden
-
rowIdSqlType
public int rowIdSqlType()Description copied from class:DialectThe JDBC type code of therowid-like pseudo-column which acts as a high-performance row locator.- Overrides:
rowIdSqlTypein classDB2Dialect- Returns:
Types.ROWIDby default
-
getRowIdColumnString
Description copied from class:DialectIf this dialect requires that therowidcolumn be declared explicitly, return the DDL column definition.- Overrides:
getRowIdColumnStringin classDialect- Returns:
- the DDL column definition, or
nullif therowidis an implicit pseudo-column
-
getForUpdateString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire pessimistic UPGRADE locks for this dialect.- Overrides:
getForUpdateStringin classDB2Dialect- Returns:
- The appropriate
FOR UPDATEclause string.
-
getForUpdateSkipLockedString
Description copied from class:DialectRetrieves theFOR UPDATE SKIP LOCKEDsyntax specific to this dialect.- Overrides:
getForUpdateSkipLockedStringin classDB2Dialect- Returns:
- The appropriate
FOR UPDATE SKIP LOCKEDclause string.
-
getForUpdateSkipLockedString
Description copied from class:DialectGet theFOR UPDATE OF column_list SKIP LOCKEDfragment appropriate for this dialect, given the aliases of the columns to be write locked.- Overrides:
getForUpdateSkipLockedStringin classDB2Dialect- Parameters:
aliases- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE colunm_list SKIP LOCKEDclause string.
-
getWriteLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.- Overrides:
getWriteLockStringin classDB2Dialect- Parameters:
timeout- How long the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate lock clause.
-
getReadLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire READ locks for this dialect.- Overrides:
getReadLockStringin classDB2Dialect- Parameters:
timeout- How long the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getWriteLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.Location of the returned string is treated the same as
Dialect.getForUpdateString().- Overrides:
getWriteLockStringin classDB2Dialect- Parameters:
timeout- How long, in milliseconds, the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getReadLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire READ locks for this dialect.Location of the returned string is treated the same as
Dialect.getForUpdateString().- Overrides:
getReadLockStringin classDB2Dialect- Parameters:
timeout- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCKclause string.
-