Top Description Fields Constructors Methods
org.hibernate.dialect

public Class DB2Dialect

extends Dialect
Class Inheritance
Known Direct Subclasses
org.hibernate.dialect.DerbyDialect, org.hibernate.dialect.DB2390Dialect, org.hibernate.dialect.DB2400Dialect, org.hibernate.dialect.DB297Dialect
Imports
java.sql.CallableStatement, .ResultSet, .SQLException, .Types, java.util.Locale, org.hibernate.JDBCException, .MappingException, .NullPrecedence, org.hibernate.cfg.Environment, org.hibernate.dialect.function.AvgWithArgumentCastFunction, .NoArgSQLFunction, .SQLFunctionTemplate, .StandardSQLFunction, .VarArgsSQLFunction, org.hibernate.dialect.identity.DB2IdentityColumnSupport, .IdentityColumnSupport, org.hibernate.dialect.pagination.AbstractLimitHandler, .LimitHandler, .LimitHelper, org.hibernate.dialect.unique.DB2UniqueDelegate, .UniqueDelegate, org.hibernate.engine.spi.RowSelection, org.hibernate.exception.LockTimeoutException, org.hibernate.exception.spi.SQLExceptionConversionDelegate, org.hibernate.hql.spi.id.IdTableSupportStandardImpl, .MultiTableBulkIdStrategy, org.hibernate.hql.spi.id.local.AfterUseAction, .LocalTemporaryTableBulkIdStrategy, org.hibernate.internal.util.JdbcExceptionHelper, org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorDB2DatabaseImpl, .SequenceInformationExtractorNoOpImpl, org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor, org.hibernate.type.StandardBasicTypes, org.hibernate.type.descriptor.sql.DecimalTypeDescriptor, .SmallIntTypeDescriptor, .SqlTypeDescriptor

An SQL dialect for DB2.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private static final int
private static final AbstractLimitHandler
private final UniqueDelegate
Inherited from org.hibernate.dialect.Dialect:
CLOSED_QUOTEDEFAULT_BATCH_SIZELEGACY_LOB_MERGE_STRATEGYNEW_LOCATOR_LOB_MERGE_STRATEGYNO_BATCHQUOTESTANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGYSTREAM_XFER_LOB_MERGE_STRATEGYTWO_SINGLE_QUOTES_REPLACEMENT

Constructor Summary

AccessConstructor and Description
public
DB2Dialect()

Constructs a DB2Dialect

Method Summary

Modifier and TypeMethod and Description
public SQLExceptionConversionDelegate
buildSQLExceptionConversionDelegate()

Overrides org.hibernate.dialect.Dialect.buildSQLExceptionConversionDelegate.

Build an instance of a SQLExceptionConversionDelegate for interpreting dialect-specific error or SQLState codes.
public int
convertToFirstRowValue(int
The user-supplied, zero-based first row offset.
zeroBasedFirstResult
)

Overrides org.hibernate.dialect.Dialect.convertToFirstRowValue.

Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset.
public boolean
doesReadCommittedCauseWritersToBlockReaders()

Overrides org.hibernate.dialect.Dialect.doesReadCommittedCauseWritersToBlockReaders.

For the underlying database, is READ_COMMITTED isolation implemented by forcing readers to wait for write locks to be released?
public boolean
dropConstraints()

Overrides org.hibernate.dialect.Dialect.dropConstraints.

Do we need to drop constraints before dropping tables in this dialect?
public String
getAddColumnString()

Overrides org.hibernate.dialect.Dialect.getAddColumnString.

The syntax used to add a column to a table (optional).
public String
getCreateSequenceString(String
The name of the sequence
sequenceName
)

Overrides org.hibernate.dialect.Dialect.getCreateSequenceString.

Typically dialects which support sequences can create a sequence with a single command.
public String
getCrossJoinSeparator()

Overrides org.hibernate.dialect.Dialect.getCrossJoinSeparator.

Returns the separator to use for defining cross joins when translating HQL queries.
public String
getCurrentTimestampSelectString()

Overrides org.hibernate.dialect.Dialect.getCurrentTimestampSelectString.

Retrieve the command used to retrieve the current timestamp from the database.
public MultiTableBulkIdStrategy
public String[]
getDropSchemaCommand(String
The name of the schema to be dropped.
schemaName
)

Overrides org.hibernate.dialect.Dialect.getDropSchemaCommand.

Get the SQL command used to drop the named schema
public String
getDropSequenceString(String
The name of the sequence
sequenceName
)

Overrides org.hibernate.dialect.Dialect.getDropSequenceString.

Typically dialects which support sequences can drop a sequence with a single command.
public String
getForUpdateString()

Overrides org.hibernate.dialect.Dialect.getForUpdateString.

Get the string to append to SELECT statements to acquire locks for this dialect.
public IdentityColumnSupport
public int
getInExpressionCountLimit()

Overrides org.hibernate.dialect.Dialect.getInExpressionCountLimit.

Return the limit that the underlying database places on the number of elements in an IN predicate.
public LimitHandler
getLimitHandler()

Overrides org.hibernate.dialect.Dialect.getLimitHandler.

Returns the delegate managing LIMIT clause.
public String
getLimitString(String
The query to which to apply the limit.
sql
,
int
The offset of the limit
offset
,
int
The limit of the limit ;)
limit
)

Overrides org.hibernate.dialect.Dialect.getLimitString.

Given a limit and an offset, apply the limit clause to the query.
public String
getLowercaseFunction()

Overrides org.hibernate.dialect.Dialect.getLowercaseFunction.

The name of the SQL function that transforms a string to lowercase
public String
getNotExpression(String
The expression to negate
expression
)

Overrides org.hibernate.dialect.Dialect.getNotExpression.

Negate an expression
public String
getQuerySequencesString()

Overrides org.hibernate.dialect.Dialect.getQuerySequencesString.

Get the select command used retrieve the names of all sequences.
public ResultSet
getResultSet(CallableStatement
The callable statement.
ps
)

Overrides org.hibernate.dialect.Dialect.getResultSet.

Given a callable statement previously processed by registerResultSetOutParameter, extract the ResultSet from the OUT parameter.
public String
getSelectClauseNullString(int
The Types type code.
sqlType
)

Overrides org.hibernate.dialect.Dialect.getSelectClauseNullString.

Given a Types type code, determine an appropriate null value to use in a select clause.
public String
getSelectSequenceNextValString(String
the name of the sequence
sequenceName
)

Overrides org.hibernate.dialect.Dialect.getSelectSequenceNextValString.

Generate the select expression fragment that will retrieve the next value of a sequence as part of another (typically DML) statement.
public SequenceInformationExtractor
public String
getSequenceNextValString(String
the name of the sequence
sequenceName
)

Overrides org.hibernate.dialect.Dialect.getSequenceNextValString.

Generate the appropriate select statement to to retrieve the next value of a sequence.
protected SqlTypeDescriptor
getSqlTypeDescriptorOverride(int
A Types constant indicating the SQL column type
sqlCode
)

Overrides org.hibernate.dialect.Dialect.getSqlTypeDescriptorOverride.

Returns the SqlTypeDescriptor that should be used to handle the given JDBC type code.
public UniqueDelegate
getUniqueDelegate()

Overrides org.hibernate.dialect.Dialect.getUniqueDelegate.

Get the UniqueDelegate supported by this dialect
public boolean
public int
registerResultSetOutParameter(CallableStatement
The callable statement.
statement
,
int
The bind position at which to register the output param.
col
)

Overrides org.hibernate.dialect.Dialect.registerResultSetOutParameter.

Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returning ResultSet *by position*.
public String

Returns:

SQL string.
renderOrderByElement
(String
The SQL order expression. In case of @OrderBy annotation user receives property placeholder (e.g. attribute name enclosed in '{' and '}' signs).
expression
,
String
Collation string in format collate IDENTIFIER, or null if expression has not been explicitly specified.
collation
,
String
Order direction. Possible values: asc, desc, or null if expression has not been explicitly specified.
order
,
NullPrecedence
Nulls precedence. Default value: NullPrecedence#NONE.
nullPrecedence
)

Overrides org.hibernate.dialect.Dialect.renderOrderByElement.

Handle DB2 "support" for null precedence...
public boolean
requiresCastingOfParametersInSelectClause()

Overrides org.hibernate.dialect.Dialect.requiresCastingOfParametersInSelectClause.

Does this dialect require that parameters appearing in the SELECT clause be wrapped in cast() calls to tell the db parser the expected type.
public boolean
supportsCommentOn()

Overrides org.hibernate.dialect.Dialect.supportsCommentOn.

Does this dialect/database support commenting on tables, columns, etc?
public boolean
supportsCurrentTimestampSelection()

Overrides org.hibernate.dialect.Dialect.supportsCurrentTimestampSelection.

Does this dialect support a way to retrieve the database's current timestamp value?
public boolean
supportsEmptyInList()

Overrides org.hibernate.dialect.Dialect.supportsEmptyInList.

Does this dialect support empty IN lists?
public boolean
supportsExistsInSelect()

Overrides org.hibernate.dialect.Dialect.supportsExistsInSelect.

Does the dialect support an exists statement in the select clause?
public boolean
supportsLimit()

Overrides org.hibernate.dialect.Dialect.supportsLimit.

Does this dialect support some form of limiting query results via a SQL clause?
public boolean
supportsLobValueChangePropogation()

Overrides org.hibernate.dialect.Dialect.supportsLobValueChangePropogation.

Does the dialect support propagating changes to LOB values back to the database?
public boolean
supportsLockTimeouts()

Overrides org.hibernate.dialect.Dialect.supportsLockTimeouts.

Informational metadata about whether this dialect is known to support specifying timeouts for requested lock acquisitions.
public boolean
supportsOuterJoinForUpdate()

Overrides org.hibernate.dialect.Dialect.supportsOuterJoinForUpdate.

Does this dialect support FOR UPDATE in conjunction with outer joined rows?
public boolean
supportsParametersInInsertSelect()

Overrides org.hibernate.dialect.Dialect.supportsParametersInInsertSelect.

Does this dialect support parameters within the SELECT clause of INSERT ...
public boolean
supportsPartitionBy()

Overrides org.hibernate.dialect.Dialect.supportsPartitionBy.

Does the underlying database support partition by
public boolean
supportsPooledSequences()

Overrides org.hibernate.dialect.Dialect.supportsPooledSequences.

Does this dialect support "pooled" sequences.
public boolean
supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()

Overrides org.hibernate.dialect.Dialect.supportsResultSetPositionQueryMethodsOnForwardOnlyCursor.

Does this dialect support asking the result set its positioning information on forward only cursors.
public boolean
supportsSequences()

Overrides org.hibernate.dialect.Dialect.supportsSequences.

Does this dialect support sequences?
public boolean
supportsTupleDistinctCounts()

Overrides org.hibernate.dialect.Dialect.supportsTupleDistinctCounts.

Does this dialect support `count(distinct a,b)`?
public boolean
supportsUnionAll()

Overrides org.hibernate.dialect.Dialect.supportsUnionAll.

Does this dialect support UNION ALL, which is generally a faster variant of UNION?
public boolean
supportsVariableLimit()

Overrides org.hibernate.dialect.Dialect.supportsVariableLimit.

Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?
public boolean
useMaxForLimit()

Overrides org.hibernate.dialect.Dialect.useMaxForLimit.

Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?
Inherited from org.hibernate.dialect.Dialect:
addSqlHintOrCommentappendLockHintappendLockHintapplyLocksToSqlareStringComparisonsCaseInsensitiveaugmentPhysicalTableTypesaugmentRecognizedTableTypesbindLimitParametersFirstbindLimitParametersInReverseOrderbuildIdentifierHelperbuildSQLExceptionConvertercanCreateCatalogcanCreateSchemacastcastcastcloseQuotecontributeTypescreateCaseFragmentcreateOuterJoinFragmentdefaultScrollModedoesRepeatableReadCauseReadersToBlockWritersequivalentTypesescapeCommentescapeLiteralforceLimitUsageforceLobAsLastValueforUpdateOfColumnsgetAddColumnSuffixStringgetAddForeignKeyConstraintStringgetAddForeignKeyConstraintStringgetAddPrimaryKeyConstraintStringgetAddUniqueConstraintStringgetAlterTableStringgetAuxiliaryDatabaseObjectExportergetCallableStatementSupportgetCascadeConstraintsStringgetCaseInsensitiveLikegetCastTypeNamegetColumnAliasExtractorgetColumnCommentgetCreateCatalogCommandgetCreateMultisetTableStringgetCreateSchemaCommandgetCreateSequenceStringgetCreateSequenceStringsgetCreateSequenceStringsgetCreateTableStringgetCreateTemporaryTableColumnAnnotationgetCurrentSchemaCommandgetCurrentTimestampSQLFunctionNamegetDefaultBatchLoadSizingStrategygetDefaultPropertiesgetDialectgetDialectgetDropCatalogCommandgetDropForeignKeyStringgetDropSequenceStringsgetDropTableStringgetForeignKeyExportergetForUpdateNowaitStringgetForUpdateNowaitStringgetForUpdateSkipLockedStringgetForUpdateSkipLockedStringgetForUpdateStringgetForUpdateStringgetForUpdateStringgetForUpdateStringgetFunctionsgetHibernateTypeNamegetHibernateTypeNamegetIndexExportergetKeywordsgetLimitStringgetLobMergeStrategygetLockingStrategygetMaxAliasLengthgetNameQualifierSupportgetNativeIdentifierGeneratorClassgetNativeIdentifierGeneratorStrategygetNoColumnsInsertStringgetNullColumnStringgetQueryHintStringgetQueryHintStringgetReadLockStringgetReadLockStringgetResultSetgetResultSetgetSchemaNameResolvergetSelectGUIDStringgetSequenceExportergetTableCommentgetTableExportergetTableTypeStringgetTypeNamegetTypeNamegetUniqueKeyExportergetViolatedConstraintNameExtractergetWriteLockStringgetWriteLockStringhasAlterTablehasSelfReferentialForeignKeyBuginlineLiteralisJdbcLogWarningsEnabledByDefaultisLegacyLimitHandlerBehaviorEnabledisLockTimeoutParameterizedisTypeNameRegisteredopenQuoteprependCommentqualifyIndexNamequoteregisterColumnTyperegisterColumnTyperegisterFunctionregisterHibernateTyperegisterHibernateTyperegisterKeywordregisterResultSetOutParameterremapSqlTypeDescriptorreplaceResultVariableInOrderByClauseWithPositionrequiresParensForTupleDistinctCountssupportsBindAsCallableArgumentsupportsCascadeDeletesupportsCaseInsensitiveLikesupportsCircularCascadeDeleteConstraintssupportsColumnChecksupportsExpectedLobUsagePatternsupportsIfExistsAfterAlterTablesupportsIfExistsAfterConstraintNamesupportsIfExistsAfterTableNamesupportsIfExistsBeforeConstraintNamesupportsIfExistsBeforeTableNamesupportsJdbcConnectionLobCreationsupportsLimitOffsetsupportsNamedParameterssupportsNationalizedTypessupportsNoColumnsInsertsupportsNonQueryWithCTEsupportsNotNullUniquesupportsNoWaitsupportsRowValueConstructorSyntaxsupportsRowValueConstructorSyntaxInInListsupportsRowValueConstructorSyntaxInSetsupportsSelectAliasInGroupByClausesupportsSkipLockedsupportsSubqueryOnMutatingTablesupportsSubselectAsInPredicateLHSsupportsTableChecksupportsTupleCountssupportsTuplesInSubqueriessupportsUnboundedLobLocatorMaterializationsupportsUniquesupportsUniqueConstraintInCreateAlterTablesupportsValuesListtoBooleanValueStringtoStringtransformSelectStringuseFollowOnLockinguseFollowOnLockinguseInputStreamToInsertBlob