Package org.hibernate.dialect
Class SQLServer2012Dialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- org.hibernate.dialect.SQLServerDialect
-
- org.hibernate.dialect.SQLServer2005Dialect
-
- org.hibernate.dialect.SQLServer2008Dialect
-
- org.hibernate.dialect.SQLServer2012Dialect
-
- All Implemented Interfaces:
ConversionContext
- Direct Known Subclasses:
SqlServer2012SpatialDialect
,SQLServer2016Dialect
public class SQLServer2012Dialect extends SQLServer2008Dialect
Microsoft SQL Server 2012 Dialect
-
-
Field Summary
-
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, DEFAULT_BATCH_SIZE, LEGACY_LOB_MERGE_STRATEGY, NEW_LOCATOR_LOB_MERGE_STRATEGY, NO_BATCH, QUOTE, STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY, TWO_SINGLE_QUOTES_REPLACEMENT
-
-
Constructor Summary
Constructors Constructor Description SQLServer2012Dialect()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
applyLocksToSql(java.lang.String sql, LockOptions aliasedLockOptions, java.util.Map<java.lang.String,java.lang.String[]> keyColumnNames)
Modifies the given SQL by applying the appropriate updates for the specified lock modes and key columns.java.lang.String
getAddColumnString()
The syntax used to add a column to a table (optional).java.lang.String
getCreateSequenceString(java.lang.String sequenceName)
Typically dialects which support sequences can create a sequence with a single command.protected LimitHandler
getDefaultLimitHandler()
MultiTableBulkIdStrategy
getDefaultMultiTableBulkIdStrategy()
java.lang.String
getDropSequenceString(java.lang.String sequenceName)
Typically dialects which support sequences can drop a sequence with a single command.java.lang.String
getForUpdateString()
Get the string to append to SELECT statements to acquire locks for this dialect.java.lang.String
getNullColumnString()
The keyword used to specify a nullable column.java.lang.String
getQueryHintString(java.lang.String sql, java.lang.String hints)
Apply a hint to the query.java.lang.String
getQuerySequencesString()
Get the select command used retrieve the names of all sequences.java.sql.ResultSet
getResultSet(java.sql.CallableStatement ps)
Given a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
from the OUT parameter.java.lang.String
getSelectGUIDString()
Get the command used to select a GUID from the underlying database.java.lang.String
getSelectSequenceNextValString(java.lang.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()
java.lang.String
getSequenceNextValString(java.lang.String sequenceName)
Generate the appropriate select statement to to retrieve the next value of a sequence.boolean
isCurrentTimestampSelectStringCallable()
Should the value returned byDialect.getCurrentTimestampSelectString()
be treated as callable.boolean
qualifyIndexName()
Do we need to qualify index names with the schema name?int
registerResultSetOutParameter(java.sql.CallableStatement statement, int col)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet
*by position*.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?boolean
supportsExistsInSelect()
Does the dialect support an exists statement in the select clause?boolean
supportsLimitOffset()
Does this dialect's LIMIT support (if any) additionally support specifying an offset?boolean
supportsPartitionBy()
Does the underlying database support partition byboolean
supportsPooledSequences()
Does this dialect support "pooled" sequences.boolean
supportsSequences()
Does this dialect support sequences?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
supportsUnionAll()
Does this dialect support UNION ALL, which is generally a faster variant of UNION?-
Methods inherited from class org.hibernate.dialect.SQLServer2008Dialect
renderOrderByElement, supportsValuesList
-
Methods inherited from class org.hibernate.dialect.SQLServer2005Dialect
appendLockHint, buildSQLExceptionConversionDelegate, supportsNonQueryWithCTE, supportsNoWait, supportsSkipLocked
-
Methods inherited from class org.hibernate.dialect.SQLServerDialect
areStringComparisonsCaseInsensitive, buildIdentifierHelper, closeQuote, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, getCreateTemporaryTableColumnAnnotation, getCurrentSchemaCommand, getCurrentTimestampSelectString, getIdentityColumnSupport, getInExpressionCountLimit, getLimitHandler, getLimitString, getNameQualifierSupport, getNoColumnsInsertString, getSqlTypeDescriptorOverride, openQuote, supportsCircularCascadeDeleteConstraints, supportsLimit, supportsLobValueChangePropogation, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsVariableLimit, useMaxForLimit
-
Methods inherited from class org.hibernate.dialect.Dialect
addSqlHintOrComment, appendLockHint, augmentPhysicalTableTypes, augmentRecognizedTableTypes, bindLimitParametersFirst, bindLimitParametersInReverseOrder, buildSQLExceptionConverter, canCreateCatalog, canCreateSchema, cast, cast, cast, contributeTypes, convertToFirstRowValue, createCaseFragment, createOuterJoinFragment, defaultScrollMode, dropConstraints, equivalentTypes, escapeComment, escapeLiteral, forceLimitUsage, forceLobAsLastValue, forUpdateOfColumns, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAddUniqueConstraintString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getCastTypeName, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateMultisetTableString, getCreateSchemaCommand, getCreateSequenceString, getCreateSequenceStrings, getCreateSequenceStrings, getCreateTableString, getCrossJoinSeparator, getCurrentTimestampSQLFunctionName, getDefaultBatchLoadSizingStrategy, getDefaultProperties, getDialect, getDialect, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropSequenceStrings, getDropTableString, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFunctions, getHibernateTypeName, getHibernateTypeName, getIndexExporter, getKeywords, getLimitString, getLobMergeStrategy, getLockingStrategy, getLowercaseFunction, getMaxAliasLength, getNativeIdentifierGeneratorClass, getNativeIdentifierGeneratorStrategy, getNotExpression, getQueryHintString, getReadLockString, getReadLockString, getResultSet, getResultSet, getSchemaNameResolver, getSelectClauseNullString, getSequenceInformationExtractor, getTableComment, getTableExporter, getTableTypeString, getTypeName, getTypeName, getUniqueDelegate, getUniqueKeyExporter, getViolatedConstraintNameExtracter, getWriteLockString, getWriteLockString, hasAlterTable, hasSelfReferentialForeignKeyBug, inlineLiteral, isJdbcLogWarningsEnabledByDefault, isLegacyLimitHandlerBehaviorEnabled, isLockTimeoutParameterized, isTypeNameRegistered, prependComment, quote, registerColumnType, registerColumnType, registerFunction, registerHibernateType, registerHibernateType, registerKeyword, registerResultSetOutParameter, remapSqlTypeDescriptor, replaceResultVariableInOrderByClauseWithPosition, requiresCastingOfParametersInSelectClause, requiresParensForTupleDistinctCounts, supportsBindAsCallableArgument, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsColumnCheck, supportsCommentOn, supportsExpectedLobUsagePattern, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsJdbcConnectionLobCreation, supportsLockTimeouts, supportsNamedParameters, supportsNationalizedTypes, supportsNoColumnsInsert, supportsNotNullUnique, supportsOuterJoinForUpdate, supportsParametersInInsertSelect, supportsRowValueConstructorSyntax, supportsRowValueConstructorSyntaxInInList, supportsRowValueConstructorSyntaxInSet, supportsSelectAliasInGroupByClause, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUnique, supportsUniqueConstraintInCreateAlterTable, toBooleanValueString, toString, transformSelectString, useFollowOnLocking, useFollowOnLocking, useInputStreamToInsertBlob
-
-
-
-
Method Detail
-
supportsSequences
public boolean supportsSequences()
Description copied from class:Dialect
Does this dialect support sequences?- Overrides:
supportsSequences
in classDialect
- Returns:
- True if sequences supported; false otherwise.
-
supportsPooledSequences
public boolean supportsPooledSequences()
Description copied from class:Dialect
Does this dialect support "pooled" sequences. Not aware of a better name for this. Essentially can we specify the initial and increment values?- Overrides:
supportsPooledSequences
in classDialect
- Returns:
- True if such "pooled" sequences are supported; false otherwise.
- See Also:
Dialect.getCreateSequenceStrings(String, int, int)
,Dialect.getCreateSequenceString(String, int, int)
-
getSequenceExporter
public Exporter<Sequence> getSequenceExporter()
- Overrides:
getSequenceExporter
in classDialect
-
getCreateSequenceString
public java.lang.String getCreateSequenceString(java.lang.String sequenceName)
Description copied from class:Dialect
Typically dialects which support sequences can create a sequence with a single command. This is convenience form ofDialect.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 overrideDialect.getCreateSequenceStrings(java.lang.String)
.- Overrides:
getCreateSequenceString
in classDialect
- Parameters:
sequenceName
- The name of the sequence- Returns:
- The sequence creation command
-
getDropSequenceString
public java.lang.String getDropSequenceString(java.lang.String sequenceName)
Description copied from class:Dialect
Typically dialects which support sequences can drop a sequence with a single command. This is convenience form ofDialect.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 overrideDialect.getDropSequenceStrings(java.lang.String)
.- Overrides:
getDropSequenceString
in classDialect
- Parameters:
sequenceName
- The name of the sequence- Returns:
- The sequence drop commands
-
getSelectSequenceNextValString
public java.lang.String getSelectSequenceNextValString(java.lang.String sequenceName)
Description copied from class:Dialect
Generate the select expression fragment that will retrieve the next value of a sequence as part of another (typically DML) statement. This differs fromDialect.getSequenceNextValString(String)
in that this should return an expression usable within another statement.- Overrides:
getSelectSequenceNextValString
in classDialect
- Parameters:
sequenceName
- the name of the sequence- Returns:
- The "nextval" fragment.
-
getSequenceNextValString
public java.lang.String getSequenceNextValString(java.lang.String sequenceName)
Description copied from class:Dialect
Generate the appropriate select statement to to retrieve the next value of a sequence. This should be a "stand alone" select statement.- Overrides:
getSequenceNextValString
in classDialect
- Parameters:
sequenceName
- the name of the sequence- Returns:
- String The "nextval" select string.
-
getQuerySequencesString
public java.lang.String getQuerySequencesString()
Description copied from class:Dialect
Get the select command used retrieve the names of all sequences.- Overrides:
getQuerySequencesString
in classDialect
- Returns:
- The select command; or null if sequences are not supported.
- See Also:
SchemaUpdate
-
getQueryHintString
public java.lang.String getQueryHintString(java.lang.String sql, java.lang.String hints)
Description copied from class:Dialect
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.- Overrides:
getQueryHintString
in classDialect
- Parameters:
sql
- The query to which to apply the hint.hints
- The hints to apply- Returns:
- The modified SQL
-
supportsLimitOffset
public boolean supportsLimitOffset()
Description copied from class:Dialect
Does this dialect's LIMIT support (if any) additionally support specifying an offset?- Overrides:
supportsLimitOffset
in classSQLServerDialect
- Returns:
- True if the dialect supports an offset within the limit support.
-
getDefaultLimitHandler
protected LimitHandler getDefaultLimitHandler()
- Overrides:
getDefaultLimitHandler
in classSQLServer2005Dialect
-
getAddColumnString
public java.lang.String getAddColumnString()
Description copied from class:Dialect
The syntax used to add a column to a table (optional).- Overrides:
getAddColumnString
in classDialect
- Returns:
- The "add column" fragment.
-
getNullColumnString
public java.lang.String getNullColumnString()
Description copied from class:Dialect
The keyword used to specify a nullable column.- Overrides:
getNullColumnString
in classDialect
- Returns:
- String
-
qualifyIndexName
public boolean qualifyIndexName()
Description copied from class:Dialect
Do we need to qualify index names with the schema name?- Overrides:
qualifyIndexName
in classDialect
- Returns:
- boolean
-
getForUpdateString
public java.lang.String getForUpdateString()
Description copied from class:Dialect
Get the string to append to SELECT statements to acquire locks for this dialect.- Overrides:
getForUpdateString
in classDialect
- Returns:
- The appropriate FOR UPDATE clause string.
-
applyLocksToSql
public java.lang.String applyLocksToSql(java.lang.String sql, LockOptions aliasedLockOptions, java.util.Map<java.lang.String,java.lang.String[]> keyColumnNames)
Description copied from class:Dialect
Modifies the given SQL by applying the appropriate updates for the specified lock modes and key columns. The behavior here is that of an ANSI SQL SELECT FOR UPDATE. This method is really intended to allow dialects which do not support SELECT FOR UPDATE to achieve this in their own fashion.- Overrides:
applyLocksToSql
in classDialect
- Parameters:
sql
- the SQL string to modifyaliasedLockOptions
- lock options indexed by aliased table names.keyColumnNames
- a map of key columns indexed by aliased table names.- Returns:
- the modified SQL string.
-
registerResultSetOutParameter
public int registerResultSetOutParameter(java.sql.CallableStatement statement, int col) throws java.sql.SQLException
Description copied from class:Dialect
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet
*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.- Overrides:
registerResultSetOutParameter
in classDialect
- Parameters:
statement
- The callable statement.col
- The bind position at which to register the output param.- Returns:
- The number of (contiguous) bind positions used.
- Throws:
java.sql.SQLException
- Indicates problems registering the param.
-
getResultSet
public java.sql.ResultSet getResultSet(java.sql.CallableStatement ps) throws java.sql.SQLException
Description copied from class:Dialect
Given a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
from the OUT parameter.- Overrides:
getResultSet
in classDialect
- Parameters:
ps
- The callable statement.- Returns:
- The extracted result set.
- Throws:
java.sql.SQLException
- Indicates problems extracting the result set.
-
supportsCurrentTimestampSelection
public boolean supportsCurrentTimestampSelection()
Description copied from class:Dialect
Does this dialect support a way to retrieve the database's current timestamp value?- Overrides:
supportsCurrentTimestampSelection
in classDialect
- Returns:
- True if the current timestamp can be retrieved; false otherwise.
-
isCurrentTimestampSelectStringCallable
public boolean isCurrentTimestampSelectStringCallable()
Description copied from class:Dialect
Should the value returned byDialect.getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape syntax is being used...- Overrides:
isCurrentTimestampSelectStringCallable
in classDialect
- Returns:
- True if the
Dialect.getCurrentTimestampSelectString()
return is callable; false otherwise.
-
getDefaultMultiTableBulkIdStrategy
public MultiTableBulkIdStrategy getDefaultMultiTableBulkIdStrategy()
- Overrides:
getDefaultMultiTableBulkIdStrategy
in classDialect
-
getSelectGUIDString
public java.lang.String getSelectGUIDString()
Description copied from class:Dialect
Get the command used to select a GUID from the underlying database. Optional operation.- Overrides:
getSelectGUIDString
in classDialect
- Returns:
- The appropriate command.
-
supportsEmptyInList
public boolean supportsEmptyInList()
Description copied from class:Dialect
Does this dialect support empty IN lists? For example, is [where XYZ in ()] a supported construct?- Overrides:
supportsEmptyInList
in classDialect
- Returns:
- True if empty in lists are supported; false otherwise.
-
supportsUnionAll
public boolean supportsUnionAll()
Description copied from class:Dialect
Does this dialect support UNION ALL, which is generally a faster variant of UNION?- Overrides:
supportsUnionAll
in classDialect
- Returns:
- True if UNION ALL is supported; false otherwise.
-
supportsExistsInSelect
public boolean supportsExistsInSelect()
Description copied from class:Dialect
Does the dialect support an exists statement in the select clause?- Overrides:
supportsExistsInSelect
in classDialect
- Returns:
- True if exists checks are allowed in the select clause; false otherwise.
-
supportsTupleDistinctCounts
public boolean supportsTupleDistinctCounts()
Description copied from class:Dialect
Does this dialect support `count(distinct a,b)`?- Overrides:
supportsTupleDistinctCounts
in classDialect
- Returns:
- True if the database supports counting distinct tuples; false otherwise.
-
supportsTuplesInSubqueries
public boolean supportsTuplesInSubqueries()
Description copied from class:Dialect
Does this dialect support tuples in subqueries? Ex: delete from Table1 where (col1, col2) in (select col1, col2 from Table2)- Overrides:
supportsTuplesInSubqueries
in classDialect
- Returns:
- boolean
-
supportsPartitionBy
public boolean supportsPartitionBy()
Description copied from class:Dialect
Does the underlying database support partition by- Overrides:
supportsPartitionBy
in classDialect
- Returns:
- boolean
-
-