|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.dialect.Dialect
public abstract class Dialect
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.
Field Summary | |
---|---|
static String |
CLOSED_QUOTE
|
static String |
DEFAULT_BATCH_SIZE
|
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
|
static String |
QUOTE
Characters used for quoting SQL identifiers |
protected static LobMergeStrategy |
STREAM_XFER_LOB_MERGE_STRATEGY
Merge strategy based on transferring contents based on streams. |
Constructor Summary | |
---|---|
protected |
Dialect()
|
Method Summary | |
---|---|
String |
appendIdentitySelectToInsert(String insertString)
Provided we supportsInsertSelectIdentity() , then attach the
"select identity" clause to the insert statement. |
String |
appendLockHint(LockMode mode,
String tableName)
Some dialects support an alternative means to SELECT FOR UPDATE, whereby a "lock hint" is appends to the table name in the from clause. |
String |
applyLocksToSql(String sql,
LockOptions aliasedLockOptions,
Map 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. |
boolean |
bindLimitParametersFirst()
Does the LIMIT clause come at the start of the SELECT statement, rather than at the end? |
boolean |
bindLimitParametersInReverseOrder()
ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. |
SQLExceptionConversionDelegate |
buildSQLExceptionConversionDelegate()
Build an instance of a SQLExceptionConversionDelegate for
interpreting dialect-specific error or SQLState codes. |
SQLExceptionConverter |
buildSQLExceptionConverter()
Deprecated. buildSQLExceptionConversionDelegate() should be
overridden instead. |
char |
closeQuote()
The character specific to this dialect used to close a quoted identifier. |
int |
convertToFirstRowValue(int zeroBasedFirstResult)
Hibernate APIs explicitly state that setFirstResult() should be a zero-based offset. |
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. |
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? |
boolean |
dropTemporaryTableAfterUse()
Do we need to drop the temporary table after use? |
boolean |
forceLimitUsage()
Generally, if there is no limit applied to a Hibernate query we do not apply any limits to the SQL query. |
boolean |
forUpdateOfColumns()
Is FOR UPDATE OF syntax supported? |
String |
generateTemporaryTableName(String baseTableName)
Generate a temporary table name given the base table. |
String |
getAddColumnString()
The syntax used to add a column to a table (optional). |
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)
The syntax used to add a unique constraint to a table. |
String |
getCascadeConstraintsString()
Completely optional cascading drop clause |
String |
getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive like 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)
|
String |
getCreateMultisetTableString()
Slight variation on getCreateTableString() . |
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 |
getCreateTemporaryTablePostfix()
Get any fragments needing to be postfixed to the command for temporary table creation. |
String |
getCreateTemporaryTableString()
Command used to create a temporary table. |
String |
getCrossJoinSeparator()
|
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. |
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 System properties. |
static Dialect |
getDialect(Properties props)
Get an instance of the dialect specified by the given properties or by the current System properties. |
String |
getDropForeignKeyString()
|
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 |
getDropTemporaryTableString()
Command used to drop a temporary table. |
String |
getForUpdateNowaitString()
Retrieves the FOR UPDATE NOWAIT syntax specific to this dialect. |
String |
getForUpdateNowaitString(String aliases)
Get the FOR UPDATE OF column_list NOWAIT 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 FOR UPDATE OF column_list fragment appropriate for this dialect given the aliases of the columns to be write locked. |
String |
getForUpdateString(String aliases,
LockOptions lockOptions)
Get the FOR UPDATE OF column_list 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)
Get the name of the Hibernate Type associated with the given
Types type code. |
String |
getHibernateTypeName(int code,
int length,
int precision,
int scale)
Get the name of the Hibernate Type associated
with the given Types typecode with the given storage
specification parameters. |
protected String |
getIdentityColumnString()
The syntax used during DDL to define a column as being an IDENTITY. |
String |
getIdentityColumnString(int type)
The syntax used during DDL to define a column as being an IDENTITY of a particular type. |
String |
getIdentityInsertString()
The keyword used to insert a generated value into an identity column (or null). |
protected String |
getIdentitySelectString()
Get the select command to use to retrieve the last generated IDENTITY value. |
String |
getIdentitySelectString(String table,
String column,
int type)
Get the select command to use to retrieve the last generated IDENTITY value for a particular table |
Set<String> |
getKeywords()
|
protected String |
getLimitString(String query,
boolean hasOffset)
Apply s limit clause to the query. |
String |
getLimitString(String query,
int offset,
int limit)
Given a limit and an offset, apply the limit clause to the query. |
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? |
Class |
getNativeIdentifierGeneratorClass()
The class (which implements IdentifierGenerator )
which acts as this dialects native generation strategy. |
String |
getNoColumnsInsertString()
The fragment used to insert a row without specifying any column values. |
String |
getNullColumnString()
The keyword used to specify a nullable column. |
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. |
ResultSet |
getResultSet(CallableStatement statement)
Given a callable statement previously processed by registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
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. |
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)
|
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. |
ViolatedConstraintNameExtracter |
getViolatedConstraintNameExtracter()
|
String |
getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect. |
boolean |
hasAlterTable()
Does this dialect support the ALTER TABLE syntax? |
boolean |
hasDataTypeInIdentityColumn()
Whether this dialect have an Identity clause added to the data type or a completely separate identity data type |
boolean |
hasSelfReferentialForeignKeyBug()
|
boolean |
isCurrentTimestampSelectStringCallable()
Should the value returned by getCurrentTimestampSelectString()
be treated as callable. |
boolean |
isLockTimeoutParameterized()
If this dialect supports specifying lock timeouts, are those timeouts rendered into the SQL string as parameters. |
char |
openQuote()
The character specific to this dialect used to begin a quoted identifier. |
Boolean |
performTemporaryTableDDLInIsolation()
Does the dialect require that temporary table DDL statements occur in isolation from other statements? This would be the case if the creation would cause any current transaction to get committed implicitly. |
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)
Registers a Hibernate Type name for the given
Types type code and maximum column length. |
protected void |
registerHibernateType(int code,
String name)
Registers a Hibernate Type name for the given
Types type code. |
protected void |
registerKeyword(String word)
|
int |
registerResultSetOutParameter(CallableStatement statement,
int position)
Registers an OUT parameter which will be returning a ResultSet . |
SqlTypeDescriptor |
remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
Allows the dialect to override a SqlTypeDescriptor . |
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 SELECT clause be wrapped in cast() calls to tell the db parser the expected type. |
boolean |
supportsBindAsCallableArgument()
Does this dialect support using a JDBC bind parameter as an argument to a function or procedure call? |
boolean |
supportsCascadeDelete()
|
boolean |
supportsCaseInsensitiveLike()
|
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()
|
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? 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... |
boolean |
supportsIdentityColumns()
Does this dialect support identity column key generation? |
boolean |
supportsIfExistsAfterTableName()
|
boolean |
supportsIfExistsBeforeTableName()
|
boolean |
supportsInsertSelectIdentity()
Does the dialect support some form of inserting and selecting the generated IDENTITY value all in the same statement. |
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 |
supportsLockTimeouts()
Informational metadata about whether this dialect is known to support specifying timeouts for requested lock acquisitions. |
boolean |
supportsNotNullUnique()
|
boolean |
supportsOuterJoinForUpdate()
Does this dialect support FOR UPDATE in conjunction with outer joined rows? |
boolean |
supportsParametersInInsertSelect()
Does this dialect support parameters within the SELECT clause of INSERT ... |
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?
For example, "... |
boolean |
supportsSequences()
Does this dialect support sequences? |
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 |
supportsTemporaryTables()
Does this dialect support temporary tables? |
boolean |
supportsTupleCounts()
Does this dialect support `count(a,b)`? |
boolean |
supportsTupleDistinctCounts()
Does this dialect support `count(distinct a,b)`? |
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 |
supportsUnionAll()
Does this dialect support UNION ALL, which is generally a faster variant of UNION? |
boolean |
supportsUnique()
Does this dialect support the UNIQUE column syntax? |
boolean |
supportsUniqueConstraintInCreateAlterTable()
Does this dialect support adding Unique constraints via create and alter table ? |
boolean |
supportsVariableLimit()
Does this dialect support bind variables (i.e., prepared statement parameters) for its limit/offset? |
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 |
useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e. |
boolean |
useMaxForLimit()
Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows? This is easiest understood via an example. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_BATCH_SIZE
public static final String NO_BATCH
public static final String QUOTE
public static final String CLOSED_QUOTE
protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy NEW_LOCATOR_LOB_MERGE_STRATEGY
Constructor Detail |
---|
protected Dialect()
Method Detail |
---|
public static Dialect getDialect() throws HibernateException
HibernateException
- If no dialect was specified, or if it could not be instantiated.public static Dialect getDialect(Properties props) throws HibernateException
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()
public String toString()
toString
in class Object
public String getTypeName(int code) throws HibernateException
Types
typecode.
code
- The Types
typecode
HibernateException
- If no mapping was specified for that type.public String getTypeName(int code, long length, int precision, int scale) throws HibernateException
Types
typecode with the given storage specification
parameters.
code
- The Types
typecodelength
- The datatype lengthprecision
- The datatype precisionscale
- The datatype scale
HibernateException
- If no mapping was specified for that type.public String getCastTypeName(int code)
Types
typecode.
code
- The Types
typecode
protected void registerColumnType(int code, long capacity, String name)
code
- The Types
typecodecapacity
- The maximum length of database typename
- The database type nameprotected void registerColumnType(int code, String name)
code
- The Types
typecodename
- The database type namepublic SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
SqlTypeDescriptor
.
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()
.
If this dialect does not provide an override or if the sqlTypeDescriptor
doe not allow itself to be
remapped, then this method simply returns the original passed sqlTypeDescriptor
sqlTypeDescriptor
- The SqlTypeDescriptor
to override
SqlTypeDescriptor
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)
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 type
SqlTypeDescriptor
to use as an override, or null
if there is no override.public LobMergeStrategy getLobMergeStrategy()
public String getHibernateTypeName(int code) throws HibernateException
Type
associated with the given
Types
type code.
code
- The Types
type code
Type
name.
HibernateException
- If no mapping was specified for that type.public String getHibernateTypeName(int code, int length, int precision, int scale) throws HibernateException
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 scale
Type
name.
HibernateException
- If no mapping was specified for that type.protected void registerHibernateType(int code, long capacity, String name)
Type
name for the given
Types
type code and maximum column length.
code
- The Types
typecodecapacity
- The maximum length of database typename
- The Hibernate Type
nameprotected void registerHibernateType(int code, String name)
Type
name for the given
Types
type code.
code
- The Types
typecodename
- The Hibernate Type
nameprotected void registerFunction(String name, SQLFunction function)
public final Map<String,SQLFunction> getFunctions()
SQLFunction
).
protected void registerKeyword(String word)
public Set<String> getKeywords()
public Class getNativeIdentifierGeneratorClass()
IdentifierGenerator
)
which acts as this dialects native generation strategy.
Comes into play whenever the user specifies the native generator.
public boolean supportsIdentityColumns()
public boolean supportsInsertSelectIdentity()
public boolean hasDataTypeInIdentityColumn()
public String appendIdentitySelectToInsert(String insertString)
supportsInsertSelectIdentity()
, then attach the
"select identity" clause to the insert statement.
Note, if supportsInsertSelectIdentity()
== false then
the insert-string should be returned without modification.
insertString
- The insert command
public String getIdentitySelectString(String table, String column, int type) throws MappingException
table
- The table into which the insert was donecolumn
- The PK column.type
- The Types
type code.
MappingException
- If IDENTITY generation is not supported.protected String getIdentitySelectString() throws MappingException
MappingException
- If IDENTITY generation is not supported.public String getIdentityColumnString(int type) throws MappingException
type
- The Types
type code.
MappingException
- If IDENTITY generation is not supported.protected String getIdentityColumnString() throws MappingException
MappingException
- If IDENTITY generation is not supported.public String getIdentityInsertString()
public boolean supportsSequences()
public boolean supportsPooledSequences()
getCreateSequenceStrings(String, int, int)
,
getCreateSequenceString(String, int, int)
public String getSequenceNextValString(String sequenceName) throws MappingException
sequenceName
- the name of the sequence
MappingException
- If sequences are not supported.public String getSelectSequenceNextValString(String sequenceName) throws MappingException
getSequenceNextValString(String)
in that this
should return an expression usable within another statement.
sequenceName
- the name of the sequence
MappingException
- If sequences are not supported.@Deprecated public String[] getCreateSequenceStrings(String sequenceName) throws MappingException
getCreateSequenceString(String, int, int)
instead
sequenceName
- The name of the sequence
MappingException
- If sequences are not supported.public String[] getCreateSequenceStrings(String sequenceName, int initialValue, int incrementSize) throws MappingException
supportsPooledSequences()
.
sequenceName
- The name of the sequenceinitialValue
- The initial value to apply to 'create sequence' statementincrementSize
- The increment value to apply to 'create sequence' statement
MappingException
- If sequences are not supported.protected String getCreateSequenceString(String sequenceName) throws MappingException
getCreateSequenceStrings(java.lang.String)
to help facilitate that.
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 sequence
MappingException
- If sequences are not supported.protected String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) throws MappingException
getCreateSequenceString(String)
, additionally
taking the initial value and increment size to be applied to the sequence
definition.
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' statement
MappingException
- If sequences are not supported.public String[] getDropSequenceStrings(String sequenceName) throws MappingException
sequenceName
- The name of the sequence
MappingException
- If sequences are not supported.protected String getDropSequenceString(String sequenceName) throws MappingException
getDropSequenceStrings(java.lang.String)
to help facilitate that.
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 sequence
MappingException
- If sequences are not supported.public String getQuerySequencesString()
SchemaUpdate
public String getSelectGUIDString()
public boolean supportsLimit()
public boolean supportsLimitOffset()
public boolean supportsVariableLimit()
public boolean bindLimitParametersInReverseOrder()
public boolean bindLimitParametersFirst()
public boolean useMaxForLimit()
public boolean forceLimitUsage()
public String getLimitString(String query, int offset, int limit)
query
- The query to which to apply the limit.offset
- The offset of the limitlimit
- The limit of the limit ;)
protected String getLimitString(String query, boolean hasOffset)
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.
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?
public int convertToFirstRowValue(int zeroBasedFirstResult)
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()
public boolean isLockTimeoutParameterized()
PreparedStatement
. If true, the param position
is always handled as the last parameter; if the dialect specifies the
lock timeout elsewhere in the SQL 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)
lockable
- The persister for the entity to be locked.lockMode
- The type of lock to be acquired.
public String getForUpdateString(LockOptions lockOptions)
lockOptions
- contains the lock mode to apply.
public String getForUpdateString(LockMode lockMode)
lockMode
- The lock mode to apply.
public String getForUpdateString()
public String getWriteLockString(int timeout)
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.
public String getReadLockString(int timeout)
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.
public boolean forUpdateOfColumns()
public boolean supportsOuterJoinForUpdate()
public String getForUpdateString(String aliases)
aliases
- The columns to be write locked.
public String getForUpdateString(String aliases, LockOptions lockOptions)
aliases
- The columns to be write locked.lockOptions
- the lock options to apply
public String getForUpdateNowaitString()
public String getForUpdateNowaitString(String aliases)
aliases
- The columns to be write locked.
public String appendLockHint(LockMode mode, String tableName)
mode
- The lock mode to applytableName
- The name of the table to which to apply the lock hint.
public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map keyColumnNames)
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()
public String getCreateMultisetTableString()
getCreateTableString()
. Here, we have the
command used to create a table when there is no primary key and
duplicate rows are expected.
Most databases do not care about the distinction; originally added for
Teradata support which does care.
public boolean supportsTemporaryTables()
public String generateTemporaryTableName(String baseTableName)
baseTableName
- The table name from which to base the temp table name.
public String getCreateTemporaryTableString()
public String getCreateTemporaryTablePostfix()
public String getDropTemporaryTableString()
public Boolean performTemporaryTableDDLInIsolation()
DatabaseMetaData.dataDefinitionCausesTransactionCommit()
method. However, that does not distinguish between temporary table
DDL and other forms of DDL; MySQL, for example, reports DDL causing a
transaction commit via its driver, even though that is not the case for
temporary table DDL.
Possible return values and their meanings:Boolean.TRUE
- Unequivocally, perform the temporary table DDL
in isolation.Boolean.FALSE
- Unequivocally, do not perform the
temporary table DDL in isolation.DatabaseMetaData.dataDefinitionCausesTransactionCommit()
public boolean dropTemporaryTableAfterUse()
public int registerResultSetOutParameter(CallableStatement statement, int position) throws SQLException
ResultSet
. How this is accomplished varies greatly
from DB to DB, hence its inclusion (along with getResultSet(java.sql.CallableStatement)
) here.
statement
- The callable statement.position
- The bind position at which to register the OUT param.
SQLException
- Indicates problems registering the OUT param.public ResultSet getResultSet(CallableStatement statement) throws SQLException
registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.
statement
- The callable statement.
SQLException
- Indicates problems extracting the result set.public boolean supportsCurrentTimestampSelection()
public boolean isCurrentTimestampSelectStringCallable()
getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape
syntax is being used...
getCurrentTimestampSelectString()
return
is callable; false otherwise.public String getCurrentTimestampSelectString()
public String getCurrentTimestampSQLFunctionName()
@Deprecated public SQLExceptionConverter buildSQLExceptionConverter()
buildSQLExceptionConversionDelegate()
should be
overridden instead.
buildSQLExceptionConversionDelegate()
should be overridden
instead.
If this method is not overridden, the default SQLExceptionConverter
implementation executes 3 SQLException converter delegates:
buildSQLExceptionConversionDelegate()
;
(it is strongly recommended that specific Dialect implementations
override buildSQLExceptionConversionDelegate()
)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()
SQLExceptionConversionDelegate
for
interpreting dialect-specific error or SQLState codes.
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:
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
getViolatedConstraintNameExtracter
in interface ConversionContext
public String getSelectClauseNullString(int sqlType)
Types
type code, determine an appropriate
null value to use in a select clause.
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()
public JoinFragment createOuterJoinFragment()
JoinFragment
strategy responsible
for handling this dialect's variations in how joins are handled.
JoinFragment
strategy.public CaseFragment createCaseFragment()
CaseFragment
strategy responsible
for handling this dialect's variations in how CASE statements are
handled.
CaseFragment
strategy.public String getNoColumnsInsertString()
public String getLowercaseFunction()
public String getCaseInsensitiveLike()
public boolean supportsCaseInsensitiveLike()
true
if the underlying Database supports case insensitive like comparison, false
otherwise.
The default is false
.public String transformSelectString(String select)
Interceptor.onPrepareStatement(String)
.
select
- The select command
public int getMaxAliasLength()
public String toBooleanValueString(boolean bool)
bool
- The boolean value
public char openQuote()
public char closeQuote()
public final String quote(String name)
name
- The value to be quoted.
openQuote()
,
closeQuote()
public boolean hasAlterTable()
public boolean dropConstraints()
public boolean qualifyIndexName()
public boolean supportsUnique()
public boolean supportsUniqueConstraintInCreateAlterTable()
public String getAddColumnString()
public String getDropForeignKeyString()
public String getTableTypeString()
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
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 to
public String getAddPrimaryKeyConstraintString(String constraintName)
constraintName
- The name of the PK constraint.
public String getAddUniqueConstraintString(String constraintName)
constraintName
- The name of the unique constraint.
public boolean hasSelfReferentialForeignKeyBug()
public String getNullColumnString()
public boolean supportsCommentOn()
public String getTableComment(String comment)
public String getColumnComment(String comment)
public boolean supportsIfExistsBeforeTableName()
public boolean supportsIfExistsAfterTableName()
public boolean supportsColumnCheck()
public boolean supportsTableCheck()
public boolean supportsCascadeDelete()
public boolean supportsNotNullUnique()
public String getCascadeConstraintsString()
public String getCrossJoinSeparator()
public ColumnAliasExtractor getColumnAliasExtractor()
public boolean supportsEmptyInList()
public boolean areStringComparisonsCaseInsensitive()
public boolean supportsRowValueConstructorSyntax()
public boolean supportsRowValueConstructorSyntaxInInList()
row values
,
does it offer such support in IN lists as well?
For example, "... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ..."
public boolean useInputStreamToInsertBlob()
PreparedStatement.setBinaryStream(int, java.io.InputStream, int)
).
public boolean supportsParametersInInsertSelect()
public boolean replaceResultVariableInOrderByClauseWithPosition()
public boolean requiresCastingOfParametersInSelectClause()
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
ResultSet.isAfterLast()
and
ResultSet.isBeforeFirst()
. Certain drivers do not
allow access to these methods for forward only cursors.
NOTE : this is highly driver dependent!
ResultSet.isAfterLast()
and
ResultSet.isBeforeFirst()
are supported for forward
only cursors; false otherwise.public boolean supportsCircularCascadeDeleteConstraints()
public boolean supportsSubselectAsInPredicateLHS()
public boolean supportsExpectedLobUsagePattern()
public boolean supportsLobValueChangePropogation()
Blob.setBinaryStream(long)
,
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()
.
public boolean supportsUnboundedLobLocatorMaterialization()
supportsExpectedLobUsagePattern()
also support the ability to materialize a LOB outside the owning transaction...
public boolean supportsSubqueryOnMutatingTable()
public boolean supportsExistsInSelect()
public boolean doesReadCommittedCauseWritersToBlockReaders()
public boolean doesRepeatableReadCauseReadersToBlockWriters()
public boolean supportsBindAsCallableArgument()
true
if the database supports accepting bind params as args, false
otherwise. The
default is true
.public boolean supportsTupleCounts()
public boolean supportsTupleDistinctCounts()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |