Top Description Inners Fields Constructors Methods
org.hibernate.dialect

public Class DerbyDialect

extends DB2Dialect
Class Inheritance
Known Direct Subclasses
org.hibernate.dialect.DerbyTenFiveDialect
Annotations
@Deprecated
Imports
java.lang.reflect.Method, java.sql.DatabaseMetaData, .SQLException, .Types, java.util.Locale, org.hibernate.MappingException, org.hibernate.dialect.function.AnsiTrimFunction, .DerbyConcatFunction, org.hibernate.dialect.pagination.AbstractLimitHandler, .LimitHandler, .LimitHelper, org.hibernate.engine.jdbc.env.spi.IdentifierHelper, .IdentifierHelperBuilder, org.hibernate.engine.spi.RowSelection, org.hibernate.hql.spi.id.IdTableSupportStandardImpl, .MultiTableBulkIdStrategy, org.hibernate.hql.spi.id.local.AfterUseAction, .LocalTemporaryTableBulkIdStrategy, org.hibernate.internal.CoreMessageLogger, org.hibernate.internal.util.ReflectHelper, org.hibernate.sql.CaseFragment, .DerbyCaseFragment, org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorDerbyDatabaseImpl, .SequenceInformationExtractorNoOpImpl, org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor, org.jboss.logging.Logger

Deprecated

HHH-6073

Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an override for the identity column generator as well as for the case statement issue documented at: http://www.jroller.com/comments/kenlars99/Weblog/cloudscape_soon_to_be_derby
Author
Simon Johnston

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private int
private int
private final LimitHandler
private static final CoreMessageLogger

Constructor Summary

AccessConstructor and Description
public
DerbyDialect()

Constructs a DerbyDialect

Method Summary

Modifier and TypeMethod and Description
public IdentifierHelper
buildIdentifierHelper(IdentifierHelperBuilder
A semi-configured IdentifierHelper builder.
builder
,
DatabaseMetaData
Access to the metadata returned from the driver if needed and if available.

Warning

may be null

dbMetaData
)

Overrides org.hibernate.dialect.Dialect.buildIdentifierHelper.

Build the IdentifierHelper indicated by this Dialect for handling identifier conversions.
public CaseFragment
createCaseFragment()

Overrides org.hibernate.dialect.Dialect.createCaseFragment.

Create a CaseFragment strategy responsible for handling this dialect's variations in how CASE statements are handled.
private void
public boolean
dropConstraints()

Overrides org.hibernate.dialect.DB2Dialect.dropConstraints.

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

Overrides org.hibernate.dialect.DB2Dialect.getCrossJoinSeparator.

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

Overrides org.hibernate.dialect.DB2Dialect.getDefaultMultiTableBulkIdStrategy.

From Derby docs:

    The DECLARE GLOBAL TEMPORARY TABLE statement defines a temporary table for the current connection.
public String
getForUpdateString()

Overrides org.hibernate.dialect.DB2Dialect.getForUpdateString.

Get the string to append to SELECT statements to acquire locks for this dialect.
public LimitHandler
getLimitHandler()

Overrides org.hibernate.dialect.DB2Dialect.getLimitHandler.

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

Overrides org.hibernate.dialect.DB2Dialect.getLimitString.

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

Overrides org.hibernate.dialect.DB2Dialect.getQuerySequencesString.

Get the select command used retrieve the names of all sequences.
public String
getReadLockString(int
in milliseconds, -1 for indefinite wait and 0 for no wait.
timeout
)

Overrides org.hibernate.dialect.Dialect.getReadLockString.

Get the string to append to SELECT statements to acquire READ locks for this dialect.
public SequenceInformationExtractor
public String
getSequenceNextValString(String
the name of the sequence
sequenceName
)

Overrides org.hibernate.dialect.DB2Dialect.getSequenceNextValString.

Generate the appropriate select statement to to retrieve the next value of a sequence.
private int
getWithIndex(String querySelect)

public String
getWriteLockString(int
in milliseconds, -1 for indefinite wait and 0 for no wait.
timeout
)

Overrides org.hibernate.dialect.Dialect.getWriteLockString.

Get the string to append to SELECT statements to acquire WRITE locks for this dialect.
private boolean
hasForUpdateClause(int forUpdateIndex)

private boolean
hasWithClause(String normalizedSelect)

private boolean
protected void
public boolean
supportsCommentOn()

Overrides org.hibernate.dialect.DB2Dialect.supportsCommentOn.

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

Overrides org.hibernate.dialect.DB2Dialect.supportsLimit.

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

Overrides org.hibernate.dialect.Dialect.supportsLimitOffset.

Does this dialect's LIMIT support (if any) additionally support specifying an offset?
public boolean
supportsLobValueChangePropogation()

Overrides org.hibernate.dialect.DB2Dialect.supportsLobValueChangePropogation.

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

Overrides org.hibernate.dialect.DB2Dialect.supportsPartitionBy.

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

Overrides org.hibernate.dialect.DB2Dialect.supportsSequences.

Does this dialect support sequences?
public boolean
supportsTuplesInSubqueries()

Overrides org.hibernate.dialect.Dialect.supportsTuplesInSubqueries.

Does this dialect support tuples in subqueries?
public boolean
supportsUnboundedLobLocatorMaterialization()

Overrides org.hibernate.dialect.Dialect.supportsUnboundedLobLocatorMaterialization.

Is it supported to materialize a LOB locator outside the transaction in which it was created?
public boolean
supportsVariableLimit()

Overrides org.hibernate.dialect.DB2Dialect.supportsVariableLimit.

Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?
Inherited from org.hibernate.dialect.DB2Dialect:
buildSQLExceptionConversionDelegateconvertToFirstRowValuedoesReadCommittedCauseWritersToBlockReadersgetAddColumnStringgetCreateSequenceStringgetCurrentTimestampSelectStringgetDropSchemaCommandgetDropSequenceStringgetIdentityColumnSupportgetInExpressionCountLimitgetLowercaseFunctiongetNotExpressiongetResultSetgetSelectClauseNullStringgetSelectSequenceNextValStringgetSqlTypeDescriptorOverridegetUniqueDelegateisCurrentTimestampSelectStringCallableregisterResultSetOutParameterrenderOrderByElementrequiresCastingOfParametersInSelectClausesupportsCurrentTimestampSelectionsupportsEmptyInListsupportsExistsInSelectsupportsLockTimeoutssupportsOuterJoinForUpdatesupportsParametersInInsertSelectsupportsPooledSequencessupportsResultSetPositionQueryMethodsOnForwardOnlyCursorsupportsTupleDistinctCountssupportsUnionAlluseMaxForLimit

Field Detail

driverVersionMajorback to summary
private int driverVersionMajor
driverVersionMinorback to summary
private int driverVersionMinor
limitHandlerback to summary
private final LimitHandler limitHandler
LOGback to summary
private static final CoreMessageLogger LOG

Hides org.hibernate.dialect.Dialect.LOG.

Annotations
@SuppressWarnings:deprecation

Constructor Detail

DerbyDialectback to summary
public DerbyDialect()

Constructs a DerbyDialect

Annotations
@SuppressWarnings:deprecation

Method Detail

buildIdentifierHelperback to summary
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException

Overrides org.hibernate.dialect.Dialect.buildIdentifierHelper.

Doc from org.hibernate.dialect.Dialect.buildIdentifierHelper.

Build the IdentifierHelper indicated by this Dialect for handling identifier conversions. Returning null is allowed and indicates that Hibernate should fallback to building a "standard" helper. In the fallback path, any changes made to the IdentifierHelperBuilder during this call will still be incorporated into the built IdentifierHelper.

The incoming builder will have the following set:

By default Hibernate will do the following:

Parameters
builder:IdentifierHelperBuilder

A semi-configured IdentifierHelper builder.

dbMetaData:DatabaseMetaData

Access to the metadata returned from the driver if needed and if available.

Warning

may be null

Returns:IdentifierHelper

The IdentifierHelper instance to use, or null to indicate Hibernate should use its fallback path

Annotations
@Override
Exceptions
SQLException:
Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.
createCaseFragmentback to summary
public CaseFragment createCaseFragment()

Overrides org.hibernate.dialect.Dialect.createCaseFragment.

Doc from org.hibernate.dialect.Dialect.createCaseFragment.

Create a CaseFragment strategy responsible for handling this dialect's variations in how CASE statements are handled.

Returns:CaseFragment

This dialect's CaseFragment strategy.

Annotations
@Override
determineDriverVersionback to summary
private void determineDriverVersion()
dropConstraintsback to summary
public boolean dropConstraints()

Overrides org.hibernate.dialect.DB2Dialect.dropConstraints.

Doc from org.hibernate.dialect.Dialect.dropConstraints.

Do we need to drop constraints before dropping tables in this dialect?

Returns:boolean

True if constraints must be dropped prior to dropping the table; false otherwise.

Annotations
@Override
getCrossJoinSeparatorback to summary
public String getCrossJoinSeparator()

Overrides org.hibernate.dialect.DB2Dialect.getCrossJoinSeparator.

Doc from org.hibernate.dialect.Dialect.getCrossJoinSeparator.

Returns the separator to use for defining cross joins when translating HQL queries.

Typically this will be either [ cross join ] or [, ]

Note that the spaces are important!

Returns:String

The cross join separator

Annotations
@Override
getDefaultMultiTableBulkIdStrategyback to summary
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy()

Overrides org.hibernate.dialect.DB2Dialect.getDefaultMultiTableBulkIdStrategy.

From Derby docs:

    The DECLARE GLOBAL TEMPORARY TABLE statement defines a temporary table for the current connection.
DB2Dialect returns a org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy that will make temporary tables created at startup and hence unavailable for subsequent connections.
see HHH-10238.

Annotations
@Override
getForUpdateStringback to summary
public String getForUpdateString()

Overrides org.hibernate.dialect.DB2Dialect.getForUpdateString.

Doc from org.hibernate.dialect.Dialect.getForUpdateString.

Get the string to append to SELECT statements to acquire locks for this dialect.

Returns:String

The appropriate FOR UPDATE clause string.

Annotations
@Override
getLimitHandlerback to summary
public LimitHandler getLimitHandler()

Overrides org.hibernate.dialect.DB2Dialect.getLimitHandler.

Doc from org.hibernate.dialect.Dialect.getLimitHandler.

Returns the delegate managing LIMIT clause.

Returns:LimitHandler

LIMIT clause delegate.

Annotations
@Override
getLimitStringback to summary
public String getLimitString(String query, final int offset, final int limit)

Overrides org.hibernate.dialect.DB2Dialect.getLimitString.

Doc from org.hibernate.dialect.Dialect.getLimitString.

Given a limit and an offset, apply the limit clause to the query.

From Derby 10.5 Docs:

Query
[ORDER BY clause]
[result offset clause]
[fetch first clause]
[FOR UPDATE clause]
[WITH {RR|RS|CS|UR}]
Parameters
query:String

The query to which to apply the limit.

offset:int

The offset of the limit

limit:int

The limit of the limit ;)

Returns:String

The modified query statement with the limit applied.

Annotations
@Override
getQuerySequencesStringback to summary
public String getQuerySequencesString()

Overrides org.hibernate.dialect.DB2Dialect.getQuerySequencesString.

Doc from org.hibernate.dialect.Dialect.getQuerySequencesString.

Get the select command used retrieve the names of all sequences.

Returns:String

The select command; or null if sequences are not supported.

Annotations
@Override
getReadLockStringback to summary
public String getReadLockString(int timeout)

Overrides org.hibernate.dialect.Dialect.getReadLockString.

Doc from org.hibernate.dialect.Dialect.getReadLockString.

Get the string to append to SELECT statements to acquire READ locks for this dialect. Location of the returned string is treated the same as getForUpdateString.

Parameters
timeout:int

in milliseconds, -1 for indefinite wait and 0 for no wait.

Returns:String

The appropriate LOCK clause string.

Annotations
@Override
getSequenceInformationExtractorback to summary
public SequenceInformationExtractor getSequenceInformationExtractor()

Overrides org.hibernate.dialect.DB2Dialect.getSequenceInformationExtractor.

Annotations
@Override
getSequenceNextValStringback to summary
public String getSequenceNextValString(String sequenceName)

Overrides org.hibernate.dialect.DB2Dialect.getSequenceNextValString.

Doc from org.hibernate.dialect.Dialect.getSequenceNextValString.

Generate the appropriate select statement to to retrieve the next value of a sequence.

This should be a "stand alone" select statement.

Parameters
sequenceName:String

the name of the sequence

Returns:String

String The "nextval" select string.

Annotations
@Override
getWithIndexback to summary
private int getWithIndex(String querySelect)
getWriteLockStringback to summary
public String getWriteLockString(int timeout)

Overrides org.hibernate.dialect.Dialect.getWriteLockString.

Doc from org.hibernate.dialect.Dialect.getWriteLockString.

Get the string to append to SELECT statements to acquire WRITE locks for this dialect. Location of the returned string is treated the same as getForUpdateString.

Parameters
timeout:int

in milliseconds, -1 for indefinite wait and 0 for no wait.

Returns:String

The appropriate LOCK clause string.

Annotations
@Override
hasForUpdateClauseback to summary
private boolean hasForUpdateClause(int forUpdateIndex)
hasWithClauseback to summary
private boolean hasWithClause(String normalizedSelect)
isTenPointFiveReleaseOrNewerback to summary
private boolean isTenPointFiveReleaseOrNewer()
registerDerbyKeywordsback to summary
protected void registerDerbyKeywords()
supportsCommentOnback to summary
public boolean supportsCommentOn()

Overrides org.hibernate.dialect.DB2Dialect.supportsCommentOn.

Doc from org.hibernate.dialect.Dialect.supportsCommentOn.

Does this dialect/database support commenting on tables, columns, etc?

Returns:boolean

true if commenting is supported

Annotations
@Override
supportsLimitback to summary
public boolean supportsLimit()

Overrides org.hibernate.dialect.DB2Dialect.supportsLimit.

Doc from org.hibernate.dialect.Dialect.supportsLimit.

Does this dialect support some form of limiting query results via a SQL clause?

Returns:boolean

True if this dialect supports some form of LIMIT.

Annotations
@Override
supportsLimitOffsetback to summary
public boolean supportsLimitOffset()

Overrides org.hibernate.dialect.Dialect.supportsLimitOffset.

Doc from org.hibernate.dialect.Dialect.supportsLimitOffset.

Does this dialect's LIMIT support (if any) additionally support specifying an offset?

Returns:boolean

True if the dialect supports an offset within the limit support.

Annotations
@Override
@SuppressWarnings:deprecation
supportsLobValueChangePropogationback to summary
public boolean supportsLobValueChangePropogation()

Overrides org.hibernate.dialect.DB2Dialect.supportsLobValueChangePropogation.

Doc from org.hibernate.dialect.Dialect.supportsLobValueChangePropogation.

Does the dialect support propagating changes to LOB values back to the database? Talking about mutating the internal value of the locator as opposed to supplying a new locator instance...

For BLOBs, the internal value might be changed by: Blob#setBinaryStream, Blob#setBytes(long, byte[]), Blob#setBytes(long, byte[], int, int), or Blob#truncate(long).

For CLOBs, the internal value might be changed by: Clob#setAsciiStream(long), Clob#setCharacterStream(long), Clob#setString(long, String), Clob#setString(long, String, int, int), or Clob#truncate(long).

NOTE : I do not know the correct answer currently for databases which (1) are not part of the cruise control process or (2) do not supportsExpectedLobUsagePattern.

Returns:boolean

True if the changes are propagated back to the database; false otherwise.

Annotations
@Override
supportsPartitionByback to summary
public boolean supportsPartitionBy()

Overrides org.hibernate.dialect.DB2Dialect.supportsPartitionBy.

Doc from org.hibernate.dialect.Dialect.supportsPartitionBy.

Does the underlying database support partition by

Returns:boolean

boolean

Annotations
@Override
supportsSequencesback to summary
public boolean supportsSequences()

Overrides org.hibernate.dialect.DB2Dialect.supportsSequences.

Doc from org.hibernate.dialect.Dialect.supportsSequences.

Does this dialect support sequences?

Returns:boolean

True if sequences supported; false otherwise.

Annotations
@Override
supportsTuplesInSubqueriesback to summary
public boolean supportsTuplesInSubqueries()

Overrides org.hibernate.dialect.Dialect.supportsTuplesInSubqueries.

Doc from org.hibernate.dialect.Dialect.supportsTuplesInSubqueries.

Does this dialect support tuples in subqueries? Ex: delete from Table1 where (col1, col2) in (select col1, col2 from Table2)

Returns:boolean

boolean

Annotations
@Override
supportsUnboundedLobLocatorMaterializationback to summary
public boolean supportsUnboundedLobLocatorMaterialization()

Overrides org.hibernate.dialect.Dialect.supportsUnboundedLobLocatorMaterialization.

Doc from org.hibernate.dialect.Dialect.supportsUnboundedLobLocatorMaterialization.

Is it supported to materialize a LOB locator outside the transaction in which it was created?

Again, part of the trickiness here is the fact that this is largely driver dependent.

Note

all database I have tested which supportsExpectedLobUsagePattern() also support the ability to materialize a LOB outside the owning transaction...

Returns:boolean

True if unbounded materialization is supported; false otherwise.

Annotations
@Override
supportsVariableLimitback to summary
public boolean supportsVariableLimit()

Overrides org.hibernate.dialect.DB2Dialect.supportsVariableLimit.

Doc from org.hibernate.dialect.Dialect.supportsVariableLimit.

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

Returns:boolean

True if bind variables can be used; false otherwise.

Annotations
@Override
org.hibernate.dialect back to summary

private final Class DerbyDialect.DerbyLimitHandler

extends AbstractLimitHandler
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
processSql(String
the SQL query to process.
sql
,
RowSelection
the selection criteria for rows.
selection
)

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.processSql.

Implements org.hibernate.dialect.pagination.LimitHandler.processSql.

Return processed SQL query.
public boolean
supportsLimit()

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.supportsLimit.

Implements org.hibernate.dialect.pagination.LimitHandler.supportsLimit.

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

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.supportsLimitOffset.

Implements org.hibernate.dialect.pagination.LimitHandler.supportsLimitOffset.

Does this handler's LIMIT support (if any) additionally support specifying an offset?
public boolean
supportsVariableLimit()

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.supportsVariableLimit.

Does this handler support bind variables (i.e., prepared statement parameters) for its limit/offset?
Inherited from org.hibernate.dialect.pagination.AbstractLimitHandler:
bindLimitParametersbindLimitParametersAtEndOfQuerybindLimitParametersAtStartOfQuerybindLimitParametersFirstbindLimitParametersInReverseOrderconvertToFirstRowValueforceLimitUsagegetMaxOrLimitsetMaxRowsuseMaxForLimit

Constructor Detail

DerbyLimitHandlerback to summary
private DerbyLimitHandler()

Method Detail

processSqlback to summary
public String processSql(String sql, RowSelection selection)

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.processSql.

Implements org.hibernate.dialect.pagination.LimitHandler.processSql.

Doc from org.hibernate.dialect.pagination.LimitHandler.processSql.

Return processed SQL query.

From Derby 10.5 Docs:

Query
[ORDER BY clause]
[result offset clause]
[fetch first clause]
[FOR UPDATE clause]
[WITH {RR|RS|CS|UR}]
Parameters
sql:String

the SQL query to process.

selection:RowSelection

the selection criteria for rows.

Returns:String

Query statement with LIMIT clause applied.

Annotations
@Override
supportsLimitback to summary
public boolean supportsLimit()

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.supportsLimit.

Implements org.hibernate.dialect.pagination.LimitHandler.supportsLimit.

Doc from org.hibernate.dialect.pagination.LimitHandler.supportsLimit.

Does this handler support some form of limiting query results via a SQL clause?

Returns:boolean

True if this handler supports some form of LIMIT.

Annotations
@Override
supportsLimitOffsetback to summary
public boolean supportsLimitOffset()

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.supportsLimitOffset.

Implements org.hibernate.dialect.pagination.LimitHandler.supportsLimitOffset.

Doc from org.hibernate.dialect.pagination.LimitHandler.supportsLimitOffset.

Does this handler's LIMIT support (if any) additionally support specifying an offset?

Returns:boolean

True if the handler supports an offset within the limit support.

Annotations
@Override
@SuppressWarnings:deprecation
supportsVariableLimitback to summary
public boolean supportsVariableLimit()

Overrides org.hibernate.dialect.pagination.AbstractLimitHandler.supportsVariableLimit.

Doc from org.hibernate.dialect.pagination.AbstractLimitHandler.supportsVariableLimit.

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

Returns:boolean

True if bind variables can be used; false otherwise.

Annotations
@Override