public class

DerbyDialect

extends DB2Dialect
java.lang.Object
   ↳ org.hibernate.dialect.Dialect
     ↳ org.hibernate.dialect.DB2Dialect
       ↳ org.hibernate.dialect.DerbyDialect

Class Overview

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

Summary

[Expand]
Inherited Constants
From class org.hibernate.dialect.Dialect
Public Constructors
DerbyDialect()
Public Methods
CaseFragment createCaseFragment()
Return the case statement modified for Cloudscape.
boolean dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?
String getCrossJoinSeparator()
Get the separator to use for defining cross joins when translating HQL queries.
String getForUpdateString()
Get the string to append to SELECT statements to acquire locks for this dialect.
String getLimitString(String query, int offset, int limit)
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}]
 
String getQuerySequencesString()
Get the select command used retrieve the names of all sequences.
String getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect.
String getSequenceNextValString(String sequenceName)
Generate the appropriate select statement to to retrieve the next value of a sequence.
String getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect.
boolean supportsCommentOn()
boolean supportsLimit()
Does this dialect support some form of limiting query results via a SQL clause?
boolean supportsLimitOffset()
Does this dialect's LIMIT support (if any) additionally support specifying an offset?
boolean 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...
boolean supportsSequences()
Does this dialect support sequences?
boolean 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.

boolean supportsVariableLimit()
Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?
[Expand]
Inherited Methods
From class org.hibernate.dialect.DB2Dialect
From class org.hibernate.dialect.Dialect
From class java.lang.Object

Public Constructors

public DerbyDialect ()

Public Methods

public CaseFragment createCaseFragment ()

Return the case statement modified for Cloudscape.

Returns

public boolean dropConstraints ()

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

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

public String getCrossJoinSeparator ()

Get 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!

public String getForUpdateString ()

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

Returns
  • The appropriate FOR UPDATE clause string.

public String getLimitString (String query, int offset, int limit)

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 The query to which to apply the limit.
offset The offset of the limit
limit The limit of the limit ;)
Returns
  • The modified query statement with the limit applied.

public String getQuerySequencesString ()

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

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

public String getReadLockString (int timeout)

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

Parameters
timeout in milliseconds, -1 for indefinite wait and 0 for no wait.
Returns
  • The appropriate LOCK clause string.

public String getSequenceNextValString (String sequenceName)

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

This should be a "stand alone" select statement.

Parameters
sequenceName the name of the sequence
Returns
  • String The "nextval" select string.

public String getWriteLockString (int timeout)

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

Parameters
timeout in milliseconds, -1 for indefinite wait and 0 for no wait.
Returns
  • The appropriate LOCK clause string.

public boolean supportsCommentOn ()

public boolean supportsLimit ()

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

Returns
  • True if this dialect supports some form of LIMIT.

public boolean supportsLimitOffset ()

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

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

public boolean 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: setBinaryStream(long), setBytes(long, byte[]), setBytes(long, byte[], int, int), or truncate(long).

For CLOBs, the internal value might be changed by: setAsciiStream(long), setCharacterStream(long), setString(long, String), setString(long, String, int, int), or 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
  • True if the changes are propagated back to the database; false otherwise.

public boolean supportsSequences ()

Does this dialect support sequences?

Returns
  • True if sequences supported; false otherwise.

public boolean 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
  • True if unbounded materialization is supported; false otherwise.

public boolean supportsVariableLimit ()

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

Returns
  • True if bind variables can be used; false otherwise.