public abstract class Dialect extends Object implements ConversionContext
Represents a dialect of SQL implemented by a particular RDBMS. Subclasses implement Hibernate compatibility with different systems. Subclasses should provide a public default constructor that register a set of type mappings and default Hibernate properties. Subclasses should be immutable.
Modifier and Type | Field and Description |
---|---|
static String |
CLOSED_QUOTE
Characters used as closing for quoting SQL identifiers
|
static String |
DEFAULT_BATCH_SIZE
Defines a default batch size constant
|
protected static LobMergeStrategy |
LEGACY_LOB_MERGE_STRATEGY
The legacy behavior of Hibernate.
|
protected static LobMergeStrategy |
NEW_LOCATOR_LOB_MERGE_STRATEGY
Merge strategy based on creating a new LOB locator.
|
static String |
NO_BATCH
Defines a "no batching" batch size constant
|
static String |
QUOTE
Characters used as opening for quoting SQL identifiers
|
protected BatchLoadSizingStrategy |
STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY |
protected static LobMergeStrategy |
STREAM_XFER_LOB_MERGE_STRATEGY
Merge strategy based on transferring contents based on streams.
|
Modifier | Constructor and Description |
---|---|
protected |
Dialect() |
Modifier and Type | Method and Description |
---|---|
String |
addSqlHintOrComment(String sql,
QueryParameters parameters,
boolean commentsEnabled)
Modify the SQL, adding hints or comments, if necessary
|
String |
appendLockHint(LockMode mode,
String tableName)
Deprecated.
use
appendLockHint(LockOptions,String) instead |
String |
appendLockHint(LockOptions lockOptions,
String tableName)
Some dialects support an alternative means to <tt>SELECT FOR UPDATE</tt>,
whereby a "lock hint" is appends to the table name in the from clause.
|
String |
applyLocksToSql(String sql,
LockOptions aliasedLockOptions,
Map<String,String[]> keyColumnNames)
Modifies the given SQL by applying the appropriate updates for the specified
lock modes and key columns.
|
boolean |
areStringComparisonsCaseInsensitive()
Are string comparisons implicitly case insensitive.
|
void |
augmentRecognizedTableTypes(List<String> tableTypesList) |
boolean |
bindLimitParametersFirst()
Deprecated.
getLimitHandler() should be overridden instead. |
boolean |
bindLimitParametersInReverseOrder()
Deprecated.
getLimitHandler() should be overridden instead. |
IdentifierHelper |
buildIdentifierHelper(IdentifierHelperBuilder builder,
DatabaseMetaData dbMetaData)
Build the IdentifierHelper indicated by this Dialect for handling identifier conversions.
|
SQLExceptionConversionDelegate |
buildSQLExceptionConversionDelegate()
Build an instance of a
SQLExceptionConversionDelegate for
interpreting dialect-specific error or SQLState codes. |
SQLExceptionConverter |
buildSQLExceptionConverter()
Deprecated.
buildSQLExceptionConversionDelegate() should be
overridden instead. |
boolean |
canCreateCatalog()
Does this dialect support catalog creation?
|
boolean |
canCreateSchema()
Does this dialect support schema creation?
|
String |
cast(String value,
int jdbcTypeCode,
int length)
Return an expression casting the value to the specified type.
|
String |
cast(String value,
int jdbcTypeCode,
int precision,
int scale)
Return an expression casting the value to the specified type.
|
String |
cast(String value,
int jdbcTypeCode,
int length,
int precision,
int scale)
Return an expression casting the value to the specified type
|
char |
closeQuote()
The character specific to this dialect used to close a quoted identifier.
|
void |
contributeTypes(TypeContributions typeContributions,
ServiceRegistry serviceRegistry)
Allows the Dialect to contribute additional types
|
int |
convertToFirstRowValue(int zeroBasedFirstResult)
Deprecated.
getLimitHandler() should be overridden instead. |
CaseFragment |
createCaseFragment()
Create a
CaseFragment strategy responsible
for handling this dialect’s variations in how CASE statements are
handled. |
JoinFragment |
createOuterJoinFragment()
Create a
JoinFragment strategy responsible
for handling this dialect’s variations in how joins are handled. |
ScrollMode |
defaultScrollMode()
Certain dialects support a subset of ScrollModes.
|
boolean |
doesReadCommittedCauseWritersToBlockReaders()
For the underlying database, is READ_COMMITTED isolation implemented by
forcing readers to wait for write locks to be released?
|
boolean |
doesRepeatableReadCauseReadersToBlockWriters()
For the underlying database, is REPEATABLE_READ isolation implemented by
forcing writers to wait for read locks to be released?
|
boolean |
dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?
|
protected String |
escapeLiteral(String literal)
Escape String literal.
|
boolean |
forceLimitUsage()
Deprecated.
getLimitHandler() should be overridden instead. |
boolean |
forceLobAsLastValue()
HHH-4635
Oracle expects all Lob values to be last in inserts and updates.
|
boolean |
forUpdateOfColumns()
Is <tt>FOR UPDATE OF</tt> syntax supported?
|
String |
getAddColumnString()
The syntax used to add a column to a table (optional).
|
String |
getAddColumnSuffixString()
The syntax for the suffix used to add a column to a table (optional).
|
String |
getAddForeignKeyConstraintString(String constraintName,
String foreignKeyDefinition) |
String |
getAddForeignKeyConstraintString(String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey,
boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table.
|
String |
getAddPrimaryKeyConstraintString(String constraintName)
The syntax used to add a primary key constraint to a table.
|
String |
getAddUniqueConstraintString(String constraintName)
Deprecated.
getUniqueDelegate() should be overridden instead. |
String |
getAlterTableString(String tableName)
Command used to alter a table.
|
Exporter<AuxiliaryDatabaseObject> |
getAuxiliaryDatabaseObjectExporter() |
CallableStatementSupport |
getCallableStatementSupport() |
String |
getCascadeConstraintsString()
Completely optional cascading drop clause
|
String |
getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive <b>like</b> comparison.
|
String |
getCastTypeName(int code)
Get the name of the database type appropriate for casting operations
(via the CAST() SQL function) for the given
Types typecode. |
ColumnAliasExtractor |
getColumnAliasExtractor() |
String |
getColumnComment(String comment)
Get the comment into a form supported for column definition.
|
String[] |
getCreateCatalogCommand(String catalogName)
Get the SQL command used to create the named catalog
|
String |
getCreateMultisetTableString()
Slight variation on
getCreateTableString() . |
String[] |
getCreateSchemaCommand(String schemaName)
Get the SQL command used to create the named schema
|
protected String |
getCreateSequenceString(String sequenceName)
Typically dialects which support sequences can create a sequence
with a single command.
|
protected String |
getCreateSequenceString(String sequenceName,
int initialValue,
int incrementSize)
Overloaded form of
getCreateSequenceString(String) , additionally
taking the initial value and increment size to be applied to the sequence
definition. |
String[] |
getCreateSequenceStrings(String sequenceName)
Deprecated.
Use
getCreateSequenceString(String, int, int) instead |
String[] |
getCreateSequenceStrings(String sequenceName,
int initialValue,
int incrementSize)
An optional multi-line form for databases which
supportsPooledSequences() . |
String |
getCreateTableString()
Command used to create a table.
|
String |
getCrossJoinSeparator()
Returns the separator to use for defining cross joins when translating HQL queries.
|
String |
getCurrentSchemaCommand()
Get the SQL command used to retrieve the current schema name.
|
String |
getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the
database.
|
String |
getCurrentTimestampSQLFunctionName()
The name of the database-specific SQL function for retrieving the
current timestamp.
|
BatchLoadSizingStrategy |
getDefaultBatchLoadSizingStrategy() |
MultiTableBulkIdStrategy |
getDefaultMultiTableBulkIdStrategy() |
Properties |
getDefaultProperties()
Retrieve a set of default Hibernate properties for this database.
|
static Dialect |
getDialect()
Get an instance of the dialect specified by the current <tt>System</tt> properties.
|
static Dialect |
getDialect(Properties props)
Get an instance of the dialect specified by the given properties or by
the current <tt>System</tt> properties.
|
String[] |
getDropCatalogCommand(String catalogName)
Get the SQL command used to drop the named catalog
|
String |
getDropForeignKeyString() |
String[] |
getDropSchemaCommand(String schemaName)
Get the SQL command used to drop the named schema
|
protected String |
getDropSequenceString(String sequenceName)
Typically dialects which support sequences can drop a sequence
with a single command.
|
String[] |
getDropSequenceStrings(String sequenceName)
The multiline script used to drop a sequence.
|
String |
getDropTableString(String tableName)
Generate a DROP TABLE statement
|
Exporter<ForeignKey> |
getForeignKeyExporter() |
String |
getForUpdateNowaitString()
Retrieves the <tt>FOR UPDATE NOWAIT</tt> syntax specific to this dialect.
|
String |
getForUpdateNowaitString(String aliases)
Get the <tt>FOR UPDATE OF column_list NOWAIT</tt> fragment appropriate
for this dialect given the aliases of the columns to be write locked.
|
String |
getForUpdateSkipLockedString()
Retrieves the <tt>FOR UPDATE SKIP LOCKED</tt> syntax specific to this dialect.
|
String |
getForUpdateSkipLockedString(String aliases)
Get the <tt>FOR UPDATE OF column_list SKIP LOCKED</tt> fragment appropriate
for this dialect given the aliases of the columns to be write locked.
|
String |
getForUpdateString()
Get the string to append to SELECT statements to acquire locks
for this dialect.
|
String |
getForUpdateString(LockMode lockMode)
Given a lock mode, determine the appropriate for update fragment to use.
|
String |
getForUpdateString(LockOptions lockOptions)
Given LockOptions (lockMode, timeout), determine the appropriate for update fragment to use.
|
String |
getForUpdateString(String aliases)
Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this
dialect given the aliases of the columns to be write locked.
|
String |
getForUpdateString(String aliases,
LockOptions lockOptions)
Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this
dialect given the aliases of the columns to be write locked.
|
Map<String,SQLFunction> |
getFunctions()
Retrieves a map of the dialect’s registered functions
(functionName ⇒
SQLFunction ). |
String |
getHibernateTypeName(int code)
|
String |
getHibernateTypeName(int code,
int length,
int precision,
int scale)
|
IdentityColumnSupport |
getIdentityColumnSupport()
Get the appropriate
IdentityColumnSupport |
Exporter<Index> |
getIndexExporter() |
int |
getInExpressionCountLimit()
Return the limit that the underlying database places on the number of elements in an
IN predicate. |
Set<String> |
getKeywords()
Deprecated.
These are only ever used (if at all) from the code that handles identifier quoting. So
see
buildIdentifierHelper(org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder, java.sql.DatabaseMetaData) instead |
LimitHandler |
getLimitHandler()
Returns the delegate managing LIMIT clause.
|
protected String |
getLimitString(String query,
boolean hasOffset)
Deprecated.
getLimitHandler() should be overridden instead. |
String |
getLimitString(String query,
int offset,
int limit)
Deprecated.
getLimitHandler() should be overridden instead. |
LobMergeStrategy |
getLobMergeStrategy() |
LockingStrategy |
getLockingStrategy(Lockable lockable,
LockMode lockMode)
Get a strategy instance which knows how to acquire a database-level lock
of the specified mode for this dialect.
|
String |
getLowercaseFunction()
The name of the SQL function that transforms a string to
lowercase
|
int |
getMaxAliasLength()
What is the maximum length Hibernate can use for generated aliases?
<p/>
The maximum here should account for the fact that Hibernate often needs to append "uniqueing" information
to the end of generated aliases.
|
NameQualifierSupport |
getNameQualifierSupport()
By default interpret this based on DatabaseMetaData.
|
Class |
getNativeIdentifierGeneratorClass()
Deprecated.
use
getNativeIdentifierGeneratorStrategy() instead |
String |
getNativeIdentifierGeneratorStrategy()
Resolves the native generation strategy associated to this dialect.
|
String |
getNoColumnsInsertString()
The fragment used to insert a row without specifying any column values.
|
String |
getNotExpression(String expression)
Negate an expression
|
String |
getNullColumnString()
The keyword used to specify a nullable column.
|
String |
getQueryHintString(String query,
List<String> hintList)
Apply a hint to the query.
|
String |
getQueryHintString(String query,
String hints)
Apply a hint to the query.
|
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 READ locks
for this dialect.
|
String |
getReadLockString(String aliases,
int timeout)
Get the string to append to SELECT statements to acquire READ locks
for this dialect given the aliases of the columns to be read locked.
|
ResultSet |
getResultSet(CallableStatement statement)
Given a callable statement previously processed by
registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
ResultSet |
getResultSet(CallableStatement statement,
int position)
Given a callable statement previously processed by
registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet . |
ResultSet |
getResultSet(CallableStatement statement,
String name)
Given a callable statement previously processed by
registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
SchemaNameResolver |
getSchemaNameResolver()
Get the strategy for determining the schema name of a Connection
|
String |
getSelectClauseNullString(int sqlType)
Given a
Types type code, determine an appropriate
null value to use in a select clause. |
String |
getSelectGUIDString()
Get the command used to select a GUID from the underlying database.
|
String |
getSelectSequenceNextValString(String sequenceName)
Generate the select expression fragment that will retrieve the next
value of a sequence as part of another (typically DML) statement.
|
Exporter<Sequence> |
getSequenceExporter() |
SequenceInformationExtractor |
getSequenceInformationExtractor() |
String |
getSequenceNextValString(String sequenceName)
Generate the appropriate select statement to to retrieve the next value
of a sequence.
|
protected SqlTypeDescriptor |
getSqlTypeDescriptorOverride(int sqlCode)
Returns the
SqlTypeDescriptor that should be used to handle the given JDBC type code. |
String |
getTableComment(String comment)
Get the comment into a form supported for table definition.
|
Exporter<Table> |
getTableExporter() |
String |
getTableTypeString() |
String |
getTypeName(int code)
Get the name of the database type associated with the given
Types typecode. |
String |
getTypeName(int code,
long length,
int precision,
int scale)
Get the name of the database type associated with the given
Types typecode with the given storage specification
parameters. |
UniqueDelegate |
getUniqueDelegate()
Get the UniqueDelegate supported by this dialect
|
Exporter<Constraint> |
getUniqueKeyExporter() |
ViolatedConstraintNameExtracter |
getViolatedConstraintNameExtracter() |
String |
getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect.
|
String |
getWriteLockString(String aliases,
int timeout)
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect given the aliases of the columns to be write locked.
|
boolean |
hasAlterTable()
Does this dialect support the <tt>ALTER TABLE</tt> syntax?
|
boolean |
hasSelfReferentialForeignKeyBug()
Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?
|
String |
inlineLiteral(String literal)
Inline String literal.
|
boolean |
isCurrentTimestampSelectStringCallable()
Should the value returned by
getCurrentTimestampSelectString()
be treated as callable. |
boolean |
isJdbcLogWarningsEnabledByDefault()
Does the fetching JDBC statement warning for logging is enabled by default
|
boolean |
isLegacyLimitHandlerBehaviorEnabled() |
boolean |
isLockTimeoutParameterized()
If this dialect supports specifying lock timeouts, are those timeouts
rendered into the <tt>SQL</tt> string as parameters.
|
boolean |
isTypeNameRegistered(String typeName)
Whether or not the given type name has been registered for this dialect (including both hibernate type names and
custom-registered type names).
|
char |
openQuote()
The character specific to this dialect used to begin a quoted identifier.
|
protected String |
prependComment(String sql,
String comment) |
boolean |
qualifyIndexName()
Do we need to qualify index names with the schema name?
|
String |
quote(String name)
Apply dialect-specific quoting.
|
protected void |
registerColumnType(int code,
long capacity,
String name)
Subclasses register a type name for the given type code and maximum
column length.
|
protected void |
registerColumnType(int code,
String name)
Subclasses register a type name for the given type code.
|
protected void |
registerFunction(String name,
SQLFunction function) |
protected void |
registerHibernateType(int code,
long capacity,
String name)
|
protected void |
registerHibernateType(int code,
String name)
|
protected void |
registerKeyword(String word) |
int |
registerResultSetOutParameter(CallableStatement statement,
int position)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning
ResultSet by position. |
int |
registerResultSetOutParameter(CallableStatement statement,
String name)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning
ResultSet by name. |
SqlTypeDescriptor |
remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
Allows the dialect to override a
SqlTypeDescriptor . |
String |
renderOrderByElement(String expression,
String collation,
String order,
NullPrecedence nulls)
Renders an ordering fragment
|
boolean |
replaceResultVariableInOrderByClauseWithPosition()
Does this dialect require that references to result variables
(i.e, select expresssion aliases) in an ORDER BY clause be
replaced by column positions (1-origin) as defined
by the select clause?
|
boolean |
requiresCastingOfParametersInSelectClause()
Does this dialect require that parameters appearing in the <tt>SELECT</tt> clause be wrapped in <tt>cast()</tt>
calls to tell the db parser the expected type.
|
boolean |
requiresParensForTupleDistinctCounts()
If
supportsTupleDistinctCounts() is true, does the Dialect require the tuple to be wrapped with parens? |
boolean |
supportsBindAsCallableArgument()
Does this dialect support using a JDBC bind parameter as an argument
to a function or procedure call?
|
boolean |
supportsCascadeDelete()
Does this dialect support cascaded delete on foreign key definitions?
|
boolean |
supportsCaseInsensitiveLike()
Does this dialect support case insensitive LIKE restrictions?
|
boolean |
supportsCircularCascadeDeleteConstraints()
Does this dialect support definition of cascade delete constraints
which can cause circular chains?
|
boolean |
supportsColumnCheck()
Does this dialect support column-level check constraints?
|
boolean |
supportsCommentOn()
Does this dialect/database support commenting on tables, columns, etc?
|
boolean |
supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database’s current
timestamp value?
|
boolean |
supportsEmptyInList()
Does this dialect support empty IN lists?
<p/>
For example, is [where XYZ in ()] a supported construct?
|
boolean |
supportsExistsInSelect()
Does the dialect support an exists statement in the select clause?
|
boolean |
supportsExpectedLobUsagePattern()
Expected LOB usage pattern is such that I can perform an insert
via prepared statement with a parameter binding for a LOB value
without crazy casting to JDBC driver implementation-specific classes…
<p/>
Part of the trickiness here is the fact that this is largely
driver dependent.
|
boolean |
supportsIfExistsAfterAlterTable()
For an "alter table", can the phrase "if exists" be applied?
|
boolean |
supportsIfExistsAfterConstraintName()
For dropping a constraint with an "alter table", can the phrase "if exists" be applied after the constraint name?
<p/>
NOTE : Only one or the other (or neither) of this and
supportsIfExistsBeforeConstraintName() should return true |
boolean |
supportsIfExistsAfterTableName()
For dropping a table, can the phrase "if exists" be applied after the table name?
<p/>
NOTE : Only one or the other (or neither) of this and
supportsIfExistsBeforeTableName() should return true |
boolean |
supportsIfExistsBeforeConstraintName()
For dropping a constraint with an "alter table", can the phrase "if exists" be applied before the constraint name?
<p/>
NOTE : Only one or the other (or neither) of this and
supportsIfExistsAfterConstraintName() should return true |
boolean |
supportsIfExistsBeforeTableName()
For dropping a table, can the phrase "if exists" be applied before the table name?
<p/>
NOTE : Only one or the other (or neither) of this and
supportsIfExistsAfterTableName() should return true |
boolean |
supportsLimit()
Deprecated.
getLimitHandler() should be overridden instead. |
boolean |
supportsLimitOffset()
Deprecated.
getLimitHandler() should be overridden instead. |
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…
<p/>
For BLOBs, the internal value might be changed by:
Blob.setBinaryStream(long) ,
Blob.setBytes(long, byte[]) ,
Blob.setBytes(long, byte[], int, int) ,
or Blob.truncate(long) . |
boolean |
supportsLockTimeouts()
Informational metadata about whether this dialect is known to support
specifying timeouts for requested lock acquisitions.
|
boolean |
supportsNamedParameters(DatabaseMetaData databaseMetaData)
Override the DatabaseMetaData#supportsNamedParameters()
|
boolean |
supportsNationalizedTypes()
Does this dialect supports Nationalized Types
|
boolean |
supportsNonQueryWithCTE()
Does this dialect/database support non-query statements (e.g.
|
boolean |
supportsNotNullUnique()
Deprecated.
getUniqueDelegate() should be overridden instead. |
boolean |
supportsNoWait()
Does this dialect/database support NO_WAIT timeout.
|
boolean |
supportsOuterJoinForUpdate()
Does this dialect support <tt>FOR UPDATE</tt> in conjunction with
outer joined rows?
|
boolean |
supportsParametersInInsertSelect()
Does this dialect support parameters within the <tt>SELECT</tt> clause of
<tt>INSERT … SELECT …</tt> statements?
|
boolean |
supportsPartitionBy()
Does the underlying database support partition by
|
boolean |
supportsPooledSequences()
Does this dialect support "pooled" sequences.
|
boolean |
supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
Does this dialect support asking the result set its positioning
information on forward only cursors.
|
boolean |
supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value
constructor" syntax; sometimes called tuple syntax.
|
boolean |
supportsRowValueConstructorSyntaxInInList()
If the dialect supports
row values ,
does it offer such support in IN lists as well?
<p/>
For example, "… where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) …" |
boolean |
supportsSequences()
Does this dialect support sequences?
|
boolean |
supportsSkipLocked()
Does this dialect/database support SKIP_LOCKED timeout.
|
boolean |
supportsSubqueryOnMutatingTable()
Does this dialect support referencing the table being mutated in
a subquery.
|
boolean |
supportsSubselectAsInPredicateLHS()
Are subselects supported as the left-hand-side (LHS) of
IN-predicates.
|
boolean |
supportsTableCheck()
Does this dialect support table-level check constraints?
|
boolean |
supportsTupleCounts()
Does this dialect support
count(a,b) ? |
boolean |
supportsTupleDistinctCounts()
Does this dialect support
count(distinct a,b) ? |
boolean |
supportsTuplesInSubqueries()
Does this dialect support tuples in subqueries? Ex:
delete from Table1 where (col1, col2) in (select col1, col2 from Table2)
|
boolean |
supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in
which it was created?
<p/>
Again, part of the trickiness here is the fact that this is largely
driver dependent.
|
boolean |
supportsUnionAll()
Does this dialect support UNION ALL, which is generally a faster
variant of UNION?
|
boolean |
supportsUnique()
Deprecated.
getUniqueDelegate() should be overridden instead. |
boolean |
supportsUniqueConstraintInCreateAlterTable()
Deprecated.
getUniqueDelegate() should be overridden instead. |
boolean |
supportsValuesList()
Does this dialect/database support VALUES list (e.g.
|
boolean |
supportsVariableLimit()
Deprecated.
getLimitHandler() should be overridden instead. |
String |
toBooleanValueString(boolean bool)
The SQL literal value to which this database maps boolean values.
|
String |
toString() |
String |
transformSelectString(String select)
Meant as a means for end users to affect the select strings being sent
to the database and perhaps manipulate them in some fashion.
|
boolean |
useFollowOnLocking()
Deprecated.
Use
useFollowOnLocking(QueryParameters) instead. |
boolean |
useFollowOnLocking(QueryParameters parameters)
Some dialects have trouble applying pessimistic locking depending upon what other query options are
specified (paging, ordering, etc).
|
boolean |
useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
|
boolean |
useMaxForLimit()
Deprecated.
getLimitHandler() should be overridden instead. |
public static final String DEFAULT_BATCH_SIZE
Defines a default batch size constant
public static final String NO_BATCH
Defines a "no batching" batch size constant
public static final String QUOTE
Characters used as opening for quoting SQL identifiers
public static final String CLOSED_QUOTE
Characters used as closing for quoting SQL identifiers
protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY
The legacy behavior of Hibernate. LOBs are not processed by merge
protected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY
Merge strategy based on transferring contents based on streams.
protected static final LobMergeStrategy NEW_LOCATOR_LOB_MERGE_STRATEGY
Merge strategy based on creating a new LOB locator.
protected final BatchLoadSizingStrategy STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY
public static Dialect getDialect() throws HibernateException
Get an instance of the dialect specified by the current <tt>System</tt> properties.
HibernateException
- If no dialect was specified, or if it could not be instantiated.public static Dialect getDialect(Properties props) throws HibernateException
Get an instance of the dialect specified by the given properties or by the current <tt>System</tt> properties.
props
- The properties to use for finding the dialect class to use.HibernateException
- If no dialect was specified, or if it could not be instantiated.public final Properties getDefaultProperties()
Retrieve a set of default Hibernate properties for this database.
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Allows the Dialect to contribute additional types
typeContributions
- Callback to contribute the typesserviceRegistry
- The service registrypublic String getTypeName(int code) throws HibernateException
Get the name of the database type associated with the given
Types
typecode.
code
- The Types
typecodeHibernateException
- If no mapping was specified for that type.public String getTypeName(int code, long length, int precision, int scale) throws HibernateException
Get the name of the database type associated with the given
Types
typecode with the given storage specification
parameters.
code
- The Types
typecodelength
- The datatype lengthprecision
- The datatype precisionscale
- The datatype scaleHibernateException
- If no mapping was specified for that type.public String getCastTypeName(int code)
Get the name of the database type appropriate for casting operations
(via the CAST() SQL function) for the given Types
typecode.
code
- The Types
typecodepublic String cast(String value, int jdbcTypeCode, int length, int precision, int scale)
Return an expression casting the value to the specified type
value
- The value to castjdbcTypeCode
- The JDBC type code to cast tolength
- The type lengthprecision
- The type precisionscale
- The type scalepublic String cast(String value, int jdbcTypeCode, int length)
Return an expression casting the value to the specified type. Simply calls
cast(String, int, int, int, int)
passing Column.DEFAULT_PRECISION
and
Column.DEFAULT_SCALE
as the precision/scale.
value
- The value to castjdbcTypeCode
- The JDBC type code to cast tolength
- The type lengthpublic String cast(String value, int jdbcTypeCode, int precision, int scale)
Return an expression casting the value to the specified type. Simply calls
cast(String, int, int, int, int)
passing Column.DEFAULT_LENGTH
as the length
value
- The value to castjdbcTypeCode
- The JDBC type code to cast toprecision
- The type precisionscale
- The type scaleprotected void registerColumnType(int code, long capacity, String name)
Subclasses register a type name for the given type code and maximum column length. <tt>$l</tt> in the type name with be replaced by the column length (if appropriate).
code
- The Types
typecodecapacity
- The maximum length of database typename
- The database type nameprotected void registerColumnType(int code, String name)
Subclasses register a type name for the given type code. <tt>$l</tt> in the type name with be replaced by the column length (if appropriate).
code
- The Types
typecodename
- The database type namepublic SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
Allows the dialect to override a SqlTypeDescriptor
.
<p/>
If the passed sqlTypeDescriptor
allows itself to be remapped (per
SqlTypeDescriptor.canBeRemapped()
), then this method uses
getSqlTypeDescriptorOverride(int)
to get an optional override based on the SQL code returned by
SqlTypeDescriptor.getSqlType()
.
<p/>
If this dialect does not provide an override or if the sqlTypeDescriptor
does not allow itself to be
remapped, then this method simply returns the original passed sqlTypeDescriptor
sqlTypeDescriptor
- The SqlTypeDescriptor
to overrideSqlTypeDescriptor
that should be used for this dialect;
if there is no override, then original sqlTypeDescriptor
is returned.IllegalArgumentException
- if sqlTypeDescriptor
is null.getSqlTypeDescriptorOverride(int)
protected SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode)
Returns the SqlTypeDescriptor
that should be used to handle the given JDBC type code. Returns
null
if there is no override.
sqlCode
- A Types
constant indicating the SQL column typeSqlTypeDescriptor
to use as an override, or null
if there is no override.public LobMergeStrategy getLobMergeStrategy()
public String getHibernateTypeName(int code) throws HibernateException
code
- The Types
type codeType
name.HibernateException
- If no mapping was specified for that type.public boolean isTypeNameRegistered(String typeName)
Whether or not the given type name has been registered for this dialect (including both hibernate type names and custom-registered type names).
typeName
- the type name.public String getHibernateTypeName(int code, int length, int precision, int scale) throws HibernateException
Get the name of the Hibernate Type
associated
with the given Types
typecode with the given storage
specification parameters.
code
- The Types
typecodelength
- The datatype lengthprecision
- The datatype precisionscale
- The datatype scaleType
name.HibernateException
- If no mapping was specified for that type.protected void registerHibernateType(int code, long capacity, String name)
protected void registerHibernateType(int code, String name)
protected void registerFunction(String name, SQLFunction function)
public final Map<String,SQLFunction> getFunctions()
Retrieves a map of the dialect’s registered functions
(functionName ⇒ SQLFunction
).
@Deprecated public Class getNativeIdentifierGeneratorClass()
getNativeIdentifierGeneratorStrategy()
insteadThe class (which implements IdentifierGenerator
)
which acts as this dialects native generation strategy.
<p/>
Comes into play whenever the user specifies the native generator.
public String getNativeIdentifierGeneratorStrategy()
Resolves the native generation strategy associated to this dialect. <p/> Comes into play whenever the user specifies the native generator.
public IdentityColumnSupport getIdentityColumnSupport()
Get the appropriate IdentityColumnSupport
public boolean supportsSequences()
Does this dialect support sequences?
public boolean supportsPooledSequences()
Does this dialect support "pooled" sequences. Not aware of a better name for this. Essentially can we specify the initial and increment values?
getCreateSequenceStrings(String, int, int)
,
getCreateSequenceString(String, int, int)
public String getSequenceNextValString(String sequenceName) throws MappingException
Generate the appropriate select statement to to retrieve the next value of a sequence. <p/> This should be a "stand alone" select statement.
sequenceName
- the name of the sequenceMappingException
- If sequences are not supported.public String getSelectSequenceNextValString(String sequenceName) throws MappingException
Generate the select expression fragment that will retrieve the next
value of a sequence as part of another (typically DML) statement.
<p/>
This differs from getSequenceNextValString(String)
in that this
should return an expression usable within another statement.
sequenceName
- the name of the sequenceMappingException
- If sequences are not supported.@Deprecated public String[] getCreateSequenceStrings(String sequenceName) throws MappingException
getCreateSequenceString(String, int, int)
insteadThe multiline script used to create a sequence.
sequenceName
- The name of the sequenceMappingException
- If sequences are not supported.public String[] getCreateSequenceStrings(String sequenceName, int initialValue, int incrementSize) throws MappingException
An optional multi-line form for databases which supportsPooledSequences()
.
sequenceName
- The name of the sequenceinitialValue
- The initial value to apply to 'create sequence' statementincrementSize
- The increment value to apply to 'create sequence' statementMappingException
- If sequences are not supported.protected String getCreateSequenceString(String sequenceName) throws MappingException
Typically dialects which support sequences can create a sequence
with a single command. This is convenience form of
getCreateSequenceStrings(java.lang.String)
to help facilitate that.
<p/>
Dialects which support sequences and can create a sequence in a
single command need only override this method. Dialects
which support sequences but require multiple commands to create
a sequence should instead override getCreateSequenceStrings(java.lang.String)
.
sequenceName
- The name of the sequenceMappingException
- If sequences are not supported.protected String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) throws MappingException
Overloaded form of getCreateSequenceString(String)
, additionally
taking the initial value and increment size to be applied to the sequence
definition.
</p>
The default definition is to suffix getCreateSequenceString(String)
with the string: " start with {initialValue} increment by {incrementSize}" where
{initialValue} and {incrementSize} are replacement placeholders. Generally
dialects should only need to override this method if different key phrases
are used to apply the allocation information.
sequenceName
- The name of the sequenceinitialValue
- The initial value to apply to 'create sequence' statementincrementSize
- The increment value to apply to 'create sequence' statementMappingException
- If sequences are not supported.public String[] getDropSequenceStrings(String sequenceName) throws MappingException
The multiline script used to drop a sequence.
sequenceName
- The name of the sequenceMappingException
- If sequences are not supported.protected String getDropSequenceString(String sequenceName) throws MappingException
Typically dialects which support sequences can drop a sequence
with a single command. This is convenience form of
getDropSequenceStrings(java.lang.String)
to help facilitate that.
<p/>
Dialects which support sequences and can drop a sequence in a
single command need only override this method. Dialects
which support sequences but require multiple commands to drop
a sequence should instead override getDropSequenceStrings(java.lang.String)
.
sequenceName
- The name of the sequenceMappingException
- If sequences are not supported.public String getQuerySequencesString()
Get the select command used retrieve the names of all sequences.
SchemaUpdate
public SequenceInformationExtractor getSequenceInformationExtractor()
public String getSelectGUIDString()
Get the command used to select a GUID from the underlying database. <p/> Optional operation.
public LimitHandler getLimitHandler()
Returns the delegate managing LIMIT clause.
@Deprecated public boolean supportsLimit()
getLimitHandler()
should be overridden instead.Does this dialect support some form of limiting query results via a SQL clause?
@Deprecated public boolean supportsLimitOffset()
getLimitHandler()
should be overridden instead.Does this dialect’s LIMIT support (if any) additionally support specifying an offset?
@Deprecated public boolean supportsVariableLimit()
getLimitHandler()
should be overridden instead.Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset?
@Deprecated public boolean bindLimitParametersInReverseOrder()
getLimitHandler()
should be overridden instead.ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. Does this dialect require us to bind the parameters in reverse order?
@Deprecated public boolean bindLimitParametersFirst()
getLimitHandler()
should be overridden instead.Does the <tt>LIMIT</tt> clause come at the start of the <tt>SELECT</tt> statement, rather than at the end?
@Deprecated public boolean useMaxForLimit()
getLimitHandler()
should be overridden instead.Does the <tt>LIMIT</tt> clause take a "maximum" row number instead of a total number of returned rows? <p/> This is easiest understood via an example. Consider you have a table with 20 rows, but you only want to retrieve rows number 11 through 20. Generally, a limit with offset would say that the offset = 11 and the limit = 10 (we only want 10 rows at a time); this is specifying the total number of returned rows. Some dialects require that we instead specify offset = 11 and limit = 20, where 20 is the "last" row we want relative to offset (i.e. total number of rows = 20 - 11 = 9) <p/> So essentially, is limit relative from offset? Or is limit absolute?
@Deprecated public boolean forceLimitUsage()
getLimitHandler()
should be overridden instead.Generally, if there is no limit applied to a Hibernate query we do not apply any limits to the SQL query. This option forces that the limit be written to the SQL query.
@Deprecated public String getLimitString(String query, int offset, int limit)
getLimitHandler()
should be overridden instead.Given a limit and an offset, apply the limit clause to the query.
query
- The query to which to apply the limit.offset
- The offset of the limitlimit
- The limit of the limit ;)@Deprecated protected String getLimitString(String query, boolean hasOffset)
getLimitHandler()
should be overridden instead.Apply s limit clause to the query.
<p/>
Typically dialects utilize variable
limit clauses when they support limits. Thus, when building the
select command we do not actually need to know the limit or the offest
since we will just be using placeholders.
<p/>
Here we do still pass along whether or not an offset was specified
so that dialects not supporting offsets can generate proper exceptions.
In general, dialects will override one or the other of this method and
getLimitString(String, int, int)
.
query
- The query to which to apply the limit.hasOffset
- Is the query requesting an offset?@Deprecated public int convertToFirstRowValue(int zeroBasedFirstResult)
getLimitHandler()
should be overridden instead.Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset. Here we allow the
Dialect a chance to convert that value based on what the underlying db or driver will expect.
<p/>
NOTE: what gets passed into getLimitString(String,int,int)
is the zero-based offset. Dialects which
do not supportsVariableLimit()
should take care to perform any needed first-row-conversion calls prior
to injecting the limit values into the SQL string.
zeroBasedFirstResult
- The user-supplied, zero-based first row offset.Query.setFirstResult(int)
,
Criteria.setFirstResult(int)
public boolean supportsLockTimeouts()
Informational metadata about whether this dialect is known to support specifying timeouts for requested lock acquisitions.
public boolean isLockTimeoutParameterized()
If this dialect supports specifying lock timeouts, are those timeouts
rendered into the <tt>SQL</tt> string as parameters. The implication
is that Hibernate will need to bind the timeout value as a parameter
in the PreparedStatement
. If true, the param position
is always handled as the last parameter; if the dialect specifies the
lock timeout elsewhere in the <tt>SQL</tt> statement then the timeout
value should be directly rendered into the statement and this method
should return false.
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode)
Get a strategy instance which knows how to acquire a database-level lock of the specified mode for this dialect.
lockable
- The persister for the entity to be locked.lockMode
- The type of lock to be acquired.public String getForUpdateString(LockOptions lockOptions)
Given LockOptions (lockMode, timeout), determine the appropriate for update fragment to use.
lockOptions
- contains the lock mode to apply.public String getForUpdateString(LockMode lockMode)
Given a lock mode, determine the appropriate for update fragment to use.
lockMode
- The lock mode to apply.public String getForUpdateString()
Get the string to append to SELECT statements to acquire locks for this dialect.
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.
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getWriteLockString(String aliases, int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect given the aliases of the columns to be write locked. Location of the of the returned string is treated the same as getForUpdateString.
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire READ locks for this dialect. Location of the of the returned string is treated the same as getForUpdateString.
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getReadLockString(String aliases, int timeout)
Get the string to append to SELECT statements to acquire READ locks for this dialect given the aliases of the columns to be read locked. Location of the of the returned string is treated the same as getForUpdateString.
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public boolean forUpdateOfColumns()
Is <tt>FOR UPDATE OF</tt> syntax supported?
public boolean supportsOuterJoinForUpdate()
Does this dialect support <tt>FOR UPDATE</tt> in conjunction with outer joined rows?
public String getForUpdateString(String aliases)
Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this dialect given the aliases of the columns to be write locked.
aliases
- The columns to be write locked.public String getForUpdateString(String aliases, LockOptions lockOptions)
Get the <tt>FOR UPDATE OF column_list</tt> fragment appropriate for this dialect given the aliases of the columns to be write locked.
aliases
- The columns to be write locked.lockOptions
- the lock options to applypublic String getForUpdateNowaitString()
Retrieves the <tt>FOR UPDATE NOWAIT</tt> syntax specific to this dialect.
public String getForUpdateSkipLockedString()
Retrieves the <tt>FOR UPDATE SKIP LOCKED</tt> syntax specific to this dialect.
public String getForUpdateNowaitString(String aliases)
Get the <tt>FOR UPDATE OF column_list NOWAIT</tt> fragment appropriate for this dialect given the aliases of the columns to be write locked.
aliases
- The columns to be write locked.public String getForUpdateSkipLockedString(String aliases)
Get the <tt>FOR UPDATE OF column_list SKIP LOCKED</tt> fragment appropriate for this dialect given the aliases of the columns to be write locked.
aliases
- The columns to be write locked.@Deprecated public String appendLockHint(LockMode mode, String tableName)
appendLockHint(LockOptions,String)
insteadSome dialects support an alternative means to <tt>SELECT FOR UPDATE</tt>, whereby a "lock hint" is appends to the table name in the from clause. <p/> contributed by <a href="http://sourceforge.net/users/heschulz">Helge Schulz</a>
mode
- The lock mode to applytableName
- The name of the table to which to apply the lock hint.public String appendLockHint(LockOptions lockOptions, String tableName)
Some dialects support an alternative means to <tt>SELECT FOR UPDATE</tt>, whereby a "lock hint" is appends to the table name in the from clause. <p/> contributed by <a href="http://sourceforge.net/users/heschulz">Helge Schulz</a>
lockOptions
- The lock options to applytableName
- The name of the table to which to apply the lock hint.public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String,String[]> keyColumnNames)
Modifies the given SQL by applying the appropriate updates for the specified lock modes and key columns. <p/> The behavior here is that of an ANSI SQL <tt>SELECT FOR UPDATE</tt>. This method is really intended to allow dialects which do not support <tt>SELECT FOR UPDATE</tt> to achieve this in their own fashion.
sql
- the SQL string to modifyaliasedLockOptions
- lock options indexed by aliased table names.keyColumnNames
- a map of key columns indexed by aliased table names.public String getCreateTableString()
Command used to create a table.
public String getAlterTableString(String tableName)
Command used to alter a table.
tableName
- The name of the table to alterpublic String getCreateMultisetTableString()
Slight variation on getCreateTableString()
. Here, we have the
command used to create a table when there is no primary key and
duplicate rows are expected.
<p/>
Most databases do not care about the distinction; originally added for
Teradata support which does care.
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy()
public int registerResultSetOutParameter(CallableStatement statement, int position) throws SQLException
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning ResultSet
by position. Pre-Java 8, registering such ResultSet-returning
parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.
statement
- The callable statement.position
- The bind position at which to register the output param.SQLException
- Indicates problems registering the param.public int registerResultSetOutParameter(CallableStatement statement, String name) throws SQLException
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning ResultSet
by name. Pre-Java 8, registering such ResultSet-returning
parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.
statement
- The callable statement.name
- The parameter name (for drivers which support named parameters).SQLException
- Indicates problems registering the param.public ResultSet getResultSet(CallableStatement statement) throws SQLException
Given a callable statement previously processed by registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.
statement
- The callable statement.SQLException
- Indicates problems extracting the result set.public ResultSet getResultSet(CallableStatement statement, int position) throws SQLException
Given a callable statement previously processed by registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
.
statement
- The callable statement.position
- The bind position at which to register the output param.SQLException
- Indicates problems extracting the result set.public ResultSet getResultSet(CallableStatement statement, String name) throws SQLException
Given a callable statement previously processed by registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.
statement
- The callable statement.name
- The parameter name (for drivers which support named parameters).SQLException
- Indicates problems extracting the result set.public boolean supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database’s current timestamp value?
public boolean isCurrentTimestampSelectStringCallable()
Should the value returned by getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape
syntax is being used…
getCurrentTimestampSelectString()
return
is callable; false otherwise.public String getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the database.
public String getCurrentTimestampSQLFunctionName()
The name of the database-specific SQL function for retrieving the current timestamp.
@Deprecated public SQLExceptionConverter buildSQLExceptionConverter()
buildSQLExceptionConversionDelegate()
should be
overridden instead.Build an instance of the SQLExceptionConverter preferred by this dialect for
converting SQLExceptions into Hibernate’s JDBCException hierarchy.
<p/>
The preferred method is to not override this method; if possible,
buildSQLExceptionConversionDelegate()
should be overridden
instead.
If this method is not overridden, the default SQLExceptionConverter
implementation executes 3 SQLException converter delegates:
<ol>
<li>a "static" delegate based on the JDBC 4 defined SQLException hierarchy;</li>
<li>the vendor-specific delegate returned by buildSQLExceptionConversionDelegate()
;
(it is strongly recommended that specific Dialect implementations
override buildSQLExceptionConversionDelegate()
)</li>
<li>a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes,
depending on java.sql.DatabaseMetaData#getSQLStateType</li>
</ol>
<p/>
If this method is overridden, it is strongly recommended that the
returned SQLExceptionConverter
interpret SQL errors based on
vendor-specific error codes rather than the SQLState since the
interpretation is more accurate when using vendor-specific ErrorCodes.
SQLExceptionConverter
should be used.#buildSQLExceptionConversionDelegate()}
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
Build an instance of a SQLExceptionConversionDelegate
for
interpreting dialect-specific error or SQLState codes.
<p/>
When buildSQLExceptionConverter()
returns null, the default
SQLExceptionConverter
is used to interpret SQLState and
error codes. If this method is overridden to return a non-null value,
the default SQLExceptionConverter
will use the returned
SQLExceptionConversionDelegate
in addition to the following
standard delegates:
<ol>
<li>a "static" delegate based on the JDBC 4 defined SQLException hierarchy;</li>
<li>a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes,
depending on java.sql.DatabaseMetaData#getSQLStateType</li>
</ol>
<p/>
It is strongly recommended that specific Dialect implementations override this
method, since interpretation of a SQL error is much more accurate when based on
the a vendor-specific ErrorCode rather than the SQLState.
<p/>
Specific Dialects may override to return whatever is most appropriate for that vendor.
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
getViolatedConstraintNameExtracter
in interface ConversionContext
public String getSelectClauseNullString(int sqlType)
Given a Types
type code, determine an appropriate
null value to use in a select clause.
<p/>
One thing to consider here is that certain databases might
require proper casting for the nulls here since the select here
will be part of a UNION/UNION ALL.
sqlType
- The Types
type code.public boolean supportsUnionAll()
Does this dialect support UNION ALL, which is generally a faster variant of UNION?
public JoinFragment createOuterJoinFragment()
Create a JoinFragment
strategy responsible
for handling this dialect’s variations in how joins are handled.
JoinFragment
strategy.public CaseFragment createCaseFragment()
Create a CaseFragment
strategy responsible
for handling this dialect’s variations in how CASE statements are
handled.
CaseFragment
strategy.public String getNoColumnsInsertString()
The fragment used to insert a row without specifying any column values. This is not possible on some databases.
public String getLowercaseFunction()
The name of the SQL function that transforms a string to lowercase
public String getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive <b>like</b> comparison.
public boolean supportsCaseInsensitiveLike()
Does this dialect support case insensitive LIKE restrictions?
true
if the underlying database supports case insensitive like comparison,
false
otherwise. The default is false
.public String transformSelectString(String select)
Meant as a means for end users to affect the select strings being sent
to the database and perhaps manipulate them in some fashion.
<p/>
The recommend approach is to instead use
Interceptor.onPrepareStatement(String)
.
select
- The select commandpublic int getMaxAliasLength()
What is the maximum length Hibernate can use for generated aliases? <p/> The maximum here should account for the fact that Hibernate often needs to append "uniqueing" information to the end of generated aliases. That "uniqueing" information will be added to the end of a identifier generated to the length specified here; so be sure to leave some room (generally speaking 5 positions will suffice).
public String toBooleanValueString(boolean bool)
The SQL literal value to which this database maps boolean values.
bool
- The boolean valueprotected void registerKeyword(String word)
@Deprecated public Set<String> getKeywords()
buildIdentifierHelper(org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder, java.sql.DatabaseMetaData)
insteadpublic IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException
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.
<p/>
The incoming builder will have the following set:<ul>
<li>IdentifierHelperBuilder.isGloballyQuoteIdentifiers()
</li>
<li>IdentifierHelperBuilder.getUnquotedCaseStrategy()
- initialized to UPPER</li>
<li>IdentifierHelperBuilder.getQuotedCaseStrategy()
- initialized to MIXED</li>
</ul>
<p/>
By default Hibernate will do the following:<ul>
<li>Call IdentifierHelperBuilder.applyIdentifierCasing(DatabaseMetaData)
<li>Call IdentifierHelperBuilder.applyReservedWords(DatabaseMetaData)
<li>Applies AnsiSqlKeywords.sql2003()
as reserved words</li>
<li>Applies the {#link #sqlKeywords} collected here as reserved words</li>
<li>Applies the Dialect’s NameQualifierSupport, if it defines one</li>
</ul>
builder
- A semi-configured IdentifierHelper builder.dbMetaData
- Access to the metadata returned from the driver if needed and if available. WARNING: may be null
null
to indicate Hibernate should use its fallback pathSQLException
- Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.getNameQualifierSupport()
public char openQuote()
The character specific to this dialect used to begin a quoted identifier.
public char closeQuote()
The character specific to this dialect used to close a quoted identifier.
public final String quote(String name)
Apply dialect-specific quoting. <p/> By default, the incoming value is checked to see if its first character is the back-tick (`). If so, the dialect specific quoting is applied.
name
- The value to be quoted.openQuote()
,
closeQuote()
public Exporter<ForeignKey> getForeignKeyExporter()
public Exporter<Constraint> getUniqueKeyExporter()
public Exporter<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectExporter()
public boolean canCreateCatalog()
Does this dialect support catalog creation?
public String[] getCreateCatalogCommand(String catalogName)
Get the SQL command used to create the named catalog
catalogName
- The name of the catalog to be created.public String[] getDropCatalogCommand(String catalogName)
Get the SQL command used to drop the named catalog
catalogName
- The name of the catalog to be dropped.public boolean canCreateSchema()
Does this dialect support schema creation?
public String[] getCreateSchemaCommand(String schemaName)
Get the SQL command used to create the named schema
schemaName
- The name of the schema to be created.public String[] getDropSchemaCommand(String schemaName)
Get the SQL command used to drop the named schema
schemaName
- The name of the schema to be dropped.public String getCurrentSchemaCommand()
Get the SQL command used to retrieve the current schema name. Works in conjunction
with getSchemaNameResolver()
, unless the return from there does not need this
information. E.g., a custom impl might make use of the Java 1.7 addition of
the Connection.getSchema()
method
public SchemaNameResolver getSchemaNameResolver()
Get the strategy for determining the schema name of a Connection
public boolean hasAlterTable()
Does this dialect support the <tt>ALTER TABLE</tt> syntax?
public boolean dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?
public boolean qualifyIndexName()
Do we need to qualify index names with the schema name?
public String getAddColumnString()
The syntax used to add a column to a table (optional).
public String getAddColumnSuffixString()
The syntax for the suffix used to add a column to a table (optional).
public String getDropForeignKeyString()
public String getTableTypeString()
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table.
constraintName
- The FK constraint name.foreignKey
- The names of the columns comprising the FKreferencedTable
- The table referenced by the FKprimaryKey
- The explicit columns in the referencedTable referenced
by this FK.referencesPrimaryKey
- if false, constraint should be
explicit about which column names the constraint refers topublic String getAddForeignKeyConstraintString(String constraintName, String foreignKeyDefinition)
public String getAddPrimaryKeyConstraintString(String constraintName)
The syntax used to add a primary key constraint to a table.
constraintName
- The name of the PK constraint.public boolean hasSelfReferentialForeignKeyBug()
Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?
true
if the database/driver has this bugpublic String getNullColumnString()
The keyword used to specify a nullable column.
public boolean supportsCommentOn()
Does this dialect/database support commenting on tables, columns, etc?
true
if commenting is supportedpublic String getTableComment(String comment)
Get the comment into a form supported for table definition.
comment
- The comment to applypublic String getColumnComment(String comment)
Get the comment into a form supported for column definition.
comment
- The comment to applypublic boolean supportsIfExistsBeforeTableName()
For dropping a table, can the phrase "if exists" be applied before the table name?
<p/>
NOTE : Only one or the other (or neither) of this and supportsIfExistsAfterTableName()
should return true
true
if the "if exists" can be applied before the table namepublic boolean supportsIfExistsAfterTableName()
For dropping a table, can the phrase "if exists" be applied after the table name?
<p/>
NOTE : Only one or the other (or neither) of this and supportsIfExistsBeforeTableName()
should return true
true
if the "if exists" can be applied after the table namepublic boolean supportsIfExistsBeforeConstraintName()
For dropping a constraint with an "alter table", can the phrase "if exists" be applied before the constraint name?
<p/>
NOTE : Only one or the other (or neither) of this and supportsIfExistsAfterConstraintName()
should return true
true
if the "if exists" can be applied before the constraint namepublic boolean supportsIfExistsAfterConstraintName()
For dropping a constraint with an "alter table", can the phrase "if exists" be applied after the constraint name?
<p/>
NOTE : Only one or the other (or neither) of this and supportsIfExistsBeforeConstraintName()
should return true
true
if the "if exists" can be applied after the constraint namepublic boolean supportsIfExistsAfterAlterTable()
For an "alter table", can the phrase "if exists" be applied?
true
if the "if exists" can be applied after ALTER TABLEpublic String getDropTableString(String tableName)
Generate a DROP TABLE statement
tableName
- The name of the table to droppublic boolean supportsColumnCheck()
Does this dialect support column-level check constraints?
public boolean supportsTableCheck()
Does this dialect support table-level check constraints?
public boolean supportsCascadeDelete()
Does this dialect support cascaded delete on foreign key definitions?
true
indicates that the dialect does support cascaded delete on foreign keys.public String getCascadeConstraintsString()
Completely optional cascading drop clause
public String getCrossJoinSeparator()
Returns the separator to use for defining cross joins when translating HQL queries. <p/> Typically this will be either [<tt> cross join </tt>] or [<tt>, </tt>] <p/> Note that the spaces are important!
public ColumnAliasExtractor getColumnAliasExtractor()
public boolean supportsEmptyInList()
Does this dialect support empty IN lists? <p/> For example, is [where XYZ in ()] a supported construct?
public boolean areStringComparisonsCaseInsensitive()
Are string comparisons implicitly case insensitive. <p/> In other words, does [where 'XYZ' = 'xyz'] resolve to true?
public boolean supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax. <p/> Basically, does it support syntax like "… where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') …".
public boolean supportsRowValueConstructorSyntaxInInList()
If the dialect supports row values
,
does it offer such support in IN lists as well?
<p/>
For example, "… where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) …"
public boolean useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
PreparedStatement.setBinaryStream(int, java.io.InputStream, int)
).
public boolean supportsParametersInInsertSelect()
Does this dialect support parameters within the <tt>SELECT</tt> clause of <tt>INSERT … SELECT …</tt> statements?
public boolean replaceResultVariableInOrderByClauseWithPosition()
Does this dialect require that references to result variables (i.e, select expresssion aliases) in an ORDER BY clause be replaced by column positions (1-origin) as defined by the select clause?
public String renderOrderByElement(String expression, String collation, String order, NullPrecedence nulls)
Renders an ordering fragment
expression
- The SQL order expression. In case of @OrderBy
annotation user receives property placeholder
(e.g. attribute name enclosed in '{' and '}' signs).collation
- Collation string in format collate IDENTIFIER
, or null
if expression has not been explicitly specified.order
- Order direction. Possible values: asc
, desc
, or null
if expression has not been explicitly specified.nulls
- Nulls precedence. Default value: NullPrecedence.NONE
.ORDER BY
clause.public boolean requiresCastingOfParametersInSelectClause()
Does this dialect require that parameters appearing in the <tt>SELECT</tt> clause be wrapped in <tt>cast()</tt> calls to tell the db parser the expected type.
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
Does this dialect support asking the result set its positioning
information on forward only cursors. Specifically, in the case of
scrolling fetches, Hibernate needs to use
ResultSet.isAfterLast()
and
ResultSet.isBeforeFirst()
. Certain drivers do not
allow access to these methods for forward only cursors.
<p/>
NOTE : this is highly driver dependent!
ResultSet.isAfterLast()
and
ResultSet.isBeforeFirst()
are supported for forward
only cursors; false otherwise.public boolean supportsCircularCascadeDeleteConstraints()
Does this dialect support definition of cascade delete constraints which can cause circular chains?
public boolean supportsSubselectAsInPredicateLHS()
Are subselects supported as the left-hand-side (LHS) of IN-predicates. <p/> In other words, is syntax like "… <subquery> IN (1, 2, 3) …" supported?
public boolean supportsExpectedLobUsagePattern()
Expected LOB usage pattern is such that I can perform an insert via prepared statement with a parameter binding for a LOB value without crazy casting to JDBC driver implementation-specific classes… <p/> Part of the trickiness here is the fact that this is largely driver dependent. For example, Oracle (which is notoriously bad with LOB support in their drivers historically) actually does a pretty good job with LOB support as of the 10.2.x versions of their drivers…
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…
<p/>
For BLOBs, the internal value might be changed by:
Blob.setBinaryStream(long)
,
Blob.setBytes(long, byte[])
,
Blob.setBytes(long, byte[], int, int)
,
or Blob.truncate(long)
.
<p/>
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)
.
<p/>
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()
.
public boolean supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in
which it was created?
<p/>
Again, part of the trickiness here is the fact that this is largely
driver dependent.
<p/>
NOTE: all database I have tested which supportsExpectedLobUsagePattern()
also support the ability to materialize a LOB outside the owning transaction…
public boolean supportsSubqueryOnMutatingTable()
Does this dialect support referencing the table being mutated in a subquery. The "table being mutated" is the table referenced in an UPDATE or a DELETE query. And so can that table then be referenced in a subquery of said UPDATE/DELETE query. <p/> For example, would the following two syntaxes be supported:<ul> <li>delete from TABLE_A where ID not in ( select ID from TABLE_A )</li> <li>update TABLE_A set NON_ID = 'something' where ID in ( select ID from TABLE_A)</li> </ul>
public boolean supportsExistsInSelect()
Does the dialect support an exists statement in the select clause?
public boolean doesReadCommittedCauseWritersToBlockReaders()
For the underlying database, is READ_COMMITTED isolation implemented by forcing readers to wait for write locks to be released?
public boolean doesRepeatableReadCauseReadersToBlockWriters()
For the underlying database, is REPEATABLE_READ isolation implemented by forcing writers to wait for read locks to be released?
public boolean supportsBindAsCallableArgument()
Does this dialect support using a JDBC bind parameter as an argument to a function or procedure call?
true
if the database supports accepting bind params as args, false
otherwise. The
default is true
.public boolean supportsTupleCounts()
Does this dialect support count(a,b)
?
public boolean supportsTupleDistinctCounts()
Does this dialect support count(distinct a,b)
?
public boolean requiresParensForTupleDistinctCounts()
If supportsTupleDistinctCounts()
is true, does the Dialect require the tuple to be wrapped with parens?
public int getInExpressionCountLimit()
Return the limit that the underlying database places on the number of elements in an IN
predicate.
If the database defines no such limits, simply return zero or less-than-zero.
public boolean forceLobAsLastValue()
HHH-4635 Oracle expects all Lob values to be last in inserts and updates.
@Deprecated public boolean useFollowOnLocking()
useFollowOnLocking(QueryParameters)
instead.Some dialects have trouble applying pessimistic locking depending upon what other query options are specified (paging, ordering, etc). This method allows these dialects to request that locking be applied by subsequent selects.
true
indicates that the dialect requests that locking be applied by subsequent select;
false
(the default) indicates that locking should be applied to the main SQL statement..public boolean useFollowOnLocking(QueryParameters parameters)
Some dialects have trouble applying pessimistic locking depending upon what other query options are specified (paging, ordering, etc). This method allows these dialects to request that locking be applied by subsequent selects.
parameters
- query parameterstrue
indicates that the dialect requests that locking be applied by subsequent select;
false
(the default) indicates that locking should be applied to the main SQL statement..public String getNotExpression(String expression)
Negate an expression
expression
- The expression to negatepublic UniqueDelegate getUniqueDelegate()
Get the UniqueDelegate supported by this dialect
@Deprecated public boolean supportsUnique()
getUniqueDelegate()
should be overridden instead.Does this dialect support the <tt>UNIQUE</tt> column syntax?
@Deprecated public boolean supportsUniqueConstraintInCreateAlterTable()
getUniqueDelegate()
should be overridden instead.Does this dialect support adding Unique constraints via create and alter table ?
@Deprecated public String getAddUniqueConstraintString(String constraintName)
getUniqueDelegate()
should be overridden instead.The syntax used to add a unique constraint to a table.
constraintName
- The name of the unique constraint.@Deprecated public boolean supportsNotNullUnique()
getUniqueDelegate()
should be overridden instead.Is the combination of not-null and unique supported?
public String getQueryHintString(String query, List<String> hintList)
Apply a hint to the query. The entire query is provided, allowing the Dialect full control over the placement and syntax of the hint. By default, ignore the hint and simply return the query.
query
- The query to which to apply the hint.hintList
- The hints to applypublic String getQueryHintString(String query, String hints)
Apply a hint to the query. The entire query is provided, allowing the Dialect full control over the placement and syntax of the hint. By default, ignore the hint and simply return the query.
query
- The query to which to apply the hint.hints
- The hints to applypublic ScrollMode defaultScrollMode()
Certain dialects support a subset of ScrollModes. Provide a default to be used by Criteria and Query.
public boolean supportsTuplesInSubqueries()
Does this dialect support tuples in subqueries? Ex: delete from Table1 where (col1, col2) in (select col1, col2 from Table2)
public CallableStatementSupport getCallableStatementSupport()
public NameQualifierSupport getNameQualifierSupport()
By default interpret this based on DatabaseMetaData.
public BatchLoadSizingStrategy getDefaultBatchLoadSizingStrategy()
public boolean isJdbcLogWarningsEnabledByDefault()
Does the fetching JDBC statement warning for logging is enabled by default
public boolean supportsPartitionBy()
Does the underlying database support partition by
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData) throws SQLException
Override the DatabaseMetaData#supportsNamedParameters()
SQLException
- Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.public boolean supportsNationalizedTypes()
Does this dialect supports Nationalized Types
public boolean supportsNonQueryWithCTE()
Does this dialect/database support non-query statements (e.g. INSERT, UPDATE, DELETE) with CTE (Common Table Expressions)?
true
if non-query statements are supported with CTEpublic boolean supportsValuesList()
Does this dialect/database support VALUES list (e.g. VALUES (1), (2), (3) )
true
if VALUES list are supportedpublic boolean supportsSkipLocked()
Does this dialect/database support SKIP_LOCKED timeout.
true
if SKIP_LOCKED is supportedpublic boolean supportsNoWait()
Does this dialect/database support NO_WAIT timeout.
true
if NO_WAIT is supportedpublic boolean isLegacyLimitHandlerBehaviorEnabled()
public String inlineLiteral(String literal)
Inline String literal.
protected String escapeLiteral(String literal)
Escape String literal.
public String addSqlHintOrComment(String sql, QueryParameters parameters, boolean commentsEnabled)
Modify the SQL, adding hints or comments, if necessary
sql
- original sqlparameters
- query parameterscommentsEnabled
- if comments are enabledCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.