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
public class DB2iDialect extends DB2Dialect
A SQL dialect for DB2 for IBM i version 7.1 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
-
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description DB2iDialect()DB2iDialect(DatabaseVersion version)DB2iDialect(DialectResolutionInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCreateIndexString(boolean unique)The command used to create an index, usuallycreate indexorcreate unique index.StringgetCreateIndexTail(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.DatabaseVersiongetDB2Version()DB2 LUW VersionIdentityColumnSupportgetIdentityColumnSupport()Get the appropriateIdentityColumnSupportfor this dialect.LimitHandlergetLimitHandler()Obtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).protected DatabaseVersiongetMinimumSupportedVersion()Get the version of the SQL dialect that is the minimum supported by this implementation.StringgetQuerySequencesString()Get theselectcommand used retrieve the names of all sequences.StringgetRowIdColumnString(String rowId)If this dialect requires that therowidcolumn be declared explicitly, return the DDL column definition.SequenceSupportgetSequenceSupport()No support for sequences.SqlAstTranslatorFactorygetSqlAstTranslatorFactory()voidinitializeFunctionRegistry(FunctionContributions functionContributions)Initialize the given registry with any dialect-specific functions.StringrowId(String rowId)The more "standard" syntax isrid_bit(alias)but here we usealias.rowid.introwIdSqlType()The JDBC type code of therowid-like pseudo-column which acts as a high-performance row locator.booleansupportsDistinctFromPredicate()Does this dialect support some kind ofdistinct frompredicate?booleansupportsLateral()Does this dialect support the SQLlateralkeyword or a proprietary alternative?booleansupportsRecursiveCTE()Does this dialect/database support recursive CTEs?booleansupportsSkipLocked()Does this dialect supportSKIP_LOCKEDtimeout.-
Methods inherited from class org.hibernate.dialect.DB2Dialect
appendBinaryLiteral, appendBooleanValueString, appendDatetimeFormat, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, buildIdentifierHelper, buildSQLExceptionConversionDelegate, canDisableConstraints, columnType, contributeTypes, createUniqueDelegate, doesReadCommittedCauseWritersToBlockReaders, dropConstraints, extractPattern, generatedAs, getAggregateSupport, getAlterColumnTypeString, getCallableStatementSupport, getCreateUserDefinedTypeExtensionsString, getCurrentTimestampSelectString, getDefaultDecimalPrecision, getDefaultStatementBatchSize, getDisableConstraintStatement, getDropSchemaCommand, getEnableConstraintStatement, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getFractionalSecondPrecisionInNanos, getInExpressionCountLimit, getMaxIdentifierLength, getMaxVarcharLength, getReadLockString, getResultSet, getSelectClauseNullString, getSequenceInformationExtractor, getTruncateTableStatement, getUniqueDelegate, getWriteLockString, isCurrentTimestampSelectStringCallable, registerColumnTypes, registerDefaultKeywords, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, selectNullString, supportsAlterColumnType, supportsCommentOn, supportsCurrentTimestampSelection, supportsExistsInSelect, supportsInsertReturning, supportsLobValueChangePropagation, supportsLockTimeouts, supportsNonQueryWithCTE, supportsNullPrecedence, supportsOffsetInSubquery, supportsOuterJoinForUpdate, supportsPartitionBy, supportsPredicateAsExpression, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsTupleDistinctCounts, supportsValuesList, supportsWindowFunctions, timestampaddPattern, timestampdiffPattern, timestampdiffPatternV10, translateExtractField
-
Methods inherited from class org.hibernate.dialect.Dialect
addSqlHintOrComment, appendArrayLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, canBatchTruncate, canCreateCatalog, canCreateSchema, castPattern, castType, checkVersion, closeQuote, contribute, contributeFunctions, createOptionalTableUpdateOperation, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestamp, currentTimestampWithTimeZone, defaultScrollMode, doesRepeatableReadCauseReadersToBlockWriters, equivalentTypes, escapeComment, forceLobAsLastValue, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getCascadeConstraintsString, getCaseInsensitiveLike, getCheckCondition, getCheckCondition, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeKindString, getCurrentSchemaCommand, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultProperties, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintsStatement, getDmlTargetColumnQualifierSupport, getDoublePrecision, getDropCatalogCommand, getDropForeignKeyString, getDropTableString, getDropUniqueKeyString, getEnableConstraintsStatement, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFloatPrecision, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getGroupBySelectItemReferenceStrategy, getHqlTranslator, getIndexExporter, getKeywords, getLobMergeStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarbinaryLength, getMaxVarcharCapacity, getMultiKeyLoadSizingStrategy, getNameQualifierSupport, getNationalizationSupport, getNativeIdentifierGenerationType, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNoColumnsInsertString, getNullColumnString, getNullColumnString, getNullOrdering, getParameterCountLimit, getPreferredSqlTypeCodeForArray, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getQueryHintString, getReadLockString, getReadRowLockStrategy, getResultSet, getResultSet, getSchemaNameResolver, getSelectGUIDString, getSequenceExporter, getSizeStrategy, getSqmTranslatorFactory, getSupportedTemporaryTableKind, getTableCleaner, getTableComment, getTableExporter, getTableMigrator, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTimeZoneSupport, getTruncateTableStatements, getUniqueKeyExporter, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, getViolatedConstraintNameExtractor, getWriteLockString, getWriteRowLockStrategy, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, inlineLiteral, isAnsiNullOn, isEmptyStringTreatedAsNull, isJdbcLogWarningsEnabledByDefault, isLockTimeoutParameterized, openQuote, ordinal, prependComment, qualifyIndexName, quote, registerKeyword, registerKeywords, registerResultSetOutParameter, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeDescriptor, resolveSqlTypeLength, supportsBindAsCallableArgument, supportsBitType, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsExpectedLobUsagePattern, supportsFetchClause, supportsFractionalTimestampArithmetic, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsIfExistsBeforeTypeName, supportsInsertReturningGeneratedKeys, supportsJdbcConnectionLobCreation, supportsMaterializedLobAccess, supportsNamedParameters, supportsNoColumnsInsert, supportsNoWait, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsParametersInInsertSelect, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTemporalLiteralOffset, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsValuesListForInsert, supportsWait, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, trimPattern, useArrayForMultiValuedParameters, useFollowOnLocking, useInputStreamToInsertBlob, useMaterializedLobWhenCapacityExceeded
-
-
-
-
Constructor Detail
-
DB2iDialect
public DB2iDialect(DialectResolutionInfo info)
-
DB2iDialect
public DB2iDialect()
-
DB2iDialect
public DB2iDialect(DatabaseVersion version)
-
-
Method Detail
-
getMinimumSupportedVersion
protected DatabaseVersion getMinimumSupportedVersion()
Description copied from class:DialectGet the version of the SQL dialect that is the minimum supported by this implementation.- Overrides:
getMinimumSupportedVersionin classDB2Dialect
-
initializeFunctionRegistry
public void initializeFunctionRegistry(FunctionContributions functionContributions)
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])
-
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)
-
format(datetime as pattern) -
collate(string as collation) -
str(arg)- synonym ofcast(a as String) -
ifnull(arg0, arg1)- synonym ofcoalesce(a, b)
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
-
-
getDB2Version
public DatabaseVersion getDB2Version()
Description copied from class:DB2DialectDB2 LUW Version- Overrides:
getDB2Versionin classDB2Dialect
-
getCreateIndexString
public String getCreateIndexString(boolean unique)
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
public String getCreateIndexTail(boolean unique, List<Column> columns)
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
-
supportsDistinctFromPredicate
public boolean supportsDistinctFromPredicate()
Description copied from class:DialectDoes this dialect support some kind ofdistinct frompredicate?That is, does it support syntax like:
... where FIRST_NAME IS DISTINCT FROM LAST_NAME
- Overrides:
supportsDistinctFromPredicatein classDB2Dialect- Returns:
- True if this SQL dialect is known to support some kind of
distinct frompredicate; false otherwise
-
getSequenceSupport
public SequenceSupport getSequenceSupport()
No support for sequences.- Overrides:
getSequenceSupportin classDB2Dialect
-
getQuerySequencesString
public String 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
public LimitHandler getLimitHandler()
Description copied from class:DialectObtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).- Overrides:
getLimitHandlerin classDB2Dialect
-
getIdentityColumnSupport
public IdentityColumnSupport getIdentityColumnSupport()
Description copied from class:DialectGet the appropriateIdentityColumnSupportfor this dialect.- Overrides:
getIdentityColumnSupportin classDB2Dialect- Returns:
- the IdentityColumnSupport
-
supportsSkipLocked
public boolean supportsSkipLocked()
Description copied from class:DialectDoes this dialect supportSKIP_LOCKEDtimeout.- Overrides:
supportsSkipLockedin classDB2Dialect- Returns:
trueif SKIP_LOCKED is supported
-
supportsLateral
public boolean supportsLateral()
Description copied from class:DialectDoes this dialect support the SQLlateralkeyword or a proprietary alternative?- Overrides:
supportsLateralin classDB2Dialect- Returns:
trueif the underlying database supports lateral,falseotherwise. The default isfalse.
-
supportsRecursiveCTE
public boolean supportsRecursiveCTE()
Description copied from class:DialectDoes this dialect/database support recursive CTEs?- Overrides:
supportsRecursiveCTEin classDB2Dialect- Returns:
trueif recursive CTEs are supported
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Description copied from class:Dialect- Overrides:
getSqlAstTranslatorFactoryin classDB2Dialect- See Also:
StandardSqlAstTranslatorFactory,JdbcEnvironment.getSqlAstTranslatorFactory()
-
rowId
public String rowId(String 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
public String getRowIdColumnString(String rowId)
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
-
-