Top Description Constructors Methods
org.hibernate.dialect

public Class SQLServerDialect

extends AbstractTransactSQLDialect
Class Inheritance
Known Direct Subclasses
org.hibernate.dialect.SQLServer2005Dialect
Imports
java.sql.Types, org.hibernate.LockMode, org.hibernate.dialect.function.SQLFunctionTemplate, .StandardSQLFunction, .AnsiTrimEmulationFunction, org.hibernate.type.StandardBasicTypes

A dialect for Microsoft SQL Server 2000
Author
Gavin King

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
appendIdentitySelectToInsert(String
The insert command
insertSQL
)

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.appendIdentitySelectToInsert.

Use insert table(...) values(...) select SCOPE_IDENTITY()
public String
appendLockHint(LockMode
The lock mode to apply
mode
,
String
The name of the table to which to apply the lock hint.
tableName
)

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.appendLockHint.

Some dialects support an alternative means to SELECT FOR UPDATE, whereby a "lock hint" is appends to the table name in the from clause.
public boolean
public char
closeQuote()

Overrides org.hibernate.dialect.Dialect.closeQuote.

The character specific to this dialect used to close a quoted identifier.
public boolean
doesReadCommittedCauseWritersToBlockReaders()

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.doesReadCommittedCauseWritersToBlockReaders.

For the underlying database, is READ_COMMITTED isolation implemented by forcing readers to wait for write locks to be released?
public boolean
doesRepeatableReadCauseReadersToBlockWriters()

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.doesRepeatableReadCauseReadersToBlockWriters.

For the underlying database, is REPEATABLE_READ isolation implemented by forcing writers to wait for read locks to be released?
pack-priv static int
public String
getCurrentTimestampSelectString()

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.getCurrentTimestampSelectString.

Retrieve the command used to retrieve the current timestamp from the database.
public String
getLimitString(String
The query to which to apply the limit.
querySelect
,
int
The offset of the limit
offset
,
int
The limit of the limit ;)
limit
)

Overrides org.hibernate.dialect.Dialect.getLimitString.

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

Overrides org.hibernate.dialect.Dialect.getNoColumnsInsertString.

The fragment used to insert a row without specifying any column values.
public char
openQuote()

Overrides org.hibernate.dialect.Dialect.openQuote.

The character specific to this dialect used to begin a quoted identifier.
public boolean
supportsCircularCascadeDeleteConstraints()

Overrides org.hibernate.dialect.Dialect.supportsCircularCascadeDeleteConstraints.

Does this dialect support definition of cascade delete constraints which can cause circular chains?
public boolean
supportsLimit()

Overrides org.hibernate.dialect.Dialect.supportsLimit.

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

Overrides org.hibernate.dialect.Dialect.supportsLimitOffset.

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

Overrides org.hibernate.dialect.Dialect.supportsLobValueChangePropogation.

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

Overrides org.hibernate.dialect.Dialect.supportsResultSetPositionQueryMethodsOnForwardOnlyCursor.

Does this dialect support asking the result set its positioning information on forward only cursors.
public boolean
supportsVariableLimit()

Overrides org.hibernate.dialect.Dialect.supportsVariableLimit.

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

Overrides org.hibernate.dialect.Dialect.useMaxForLimit.

Does the LIMIT clause take a "maximum" row number instead of a total number of returned rows?
Inherited from org.hibernate.dialect.AbstractTransactSQLDialect:
applyLocksToSqldropTemporaryTableAfterUsegenerateTemporaryTableNamegetAddColumnStringgetForUpdateStringgetIdentityColumnStringgetIdentitySelectStringgetNullColumnStringgetResultSetgetSelectGUIDStringisCurrentTimestampSelectStringCallablequalifyIndexNameregisterResultSetOutParametersupportsCurrentTimestampSelectionsupportsEmptyInListsupportsExistsInSelectsupportsIdentityColumnssupportsInsertSelectIdentitysupportsTemporaryTablessupportsTupleDistinctCountssupportsUnionAll

Constructor Detail

SQLServerDialectback to summary
public SQLServerDialect()

Method Detail

appendIdentitySelectToInsertback to summary
public String appendIdentitySelectToInsert(String insertSQL)

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.appendIdentitySelectToInsert.

Use insert table(...) values(...) select SCOPE_IDENTITY()

Parameters
insertSQL:String

Doc from org.hibernate.dialect.Dialect.appendIdentitySelectToInsert.

The insert command

Returns:String

Doc from org.hibernate.dialect.Dialect.appendIdentitySelectToInsert.

The insert command with any necessary identity select clause attached.

appendLockHintback to summary
public String appendLockHint(LockMode mode, String tableName)

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.appendLockHint.

Doc from org.hibernate.dialect.Dialect.appendLockHint.

Some dialects support an alternative means to SELECT FOR UPDATE, whereby a "lock hint" is appends to the table name in the from clause.

contributed by Helge Schulz

Parameters
mode:LockMode

The lock mode to apply

tableName:String

The name of the table to which to apply the lock hint.

Returns:String

The table with any required lock hints.

areStringComparisonsCaseInsensitiveback to summary
public boolean areStringComparisonsCaseInsensitive()

Overrides org.hibernate.dialect.Dialect.areStringComparisonsCaseInsensitive.

Doc from org.hibernate.dialect.Dialect.areStringComparisonsCaseInsensitive.

Are string comparisons implicitly case insensitive.

In other words, does [where 'XYZ' = 'xyz'] resolve to true?

Returns:boolean

True if comparisons are case insensitive.

closeQuoteback to summary
public char closeQuote()

Overrides org.hibernate.dialect.Dialect.closeQuote.

Doc from org.hibernate.dialect.Dialect.closeQuote.

The character specific to this dialect used to close a quoted identifier.

Returns:char

The dialect's specific close quote character.

doesReadCommittedCauseWritersToBlockReadersback to summary
public boolean doesReadCommittedCauseWritersToBlockReaders()

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.doesReadCommittedCauseWritersToBlockReaders.

Doc from org.hibernate.dialect.Dialect.doesReadCommittedCauseWritersToBlockReaders.

For the underlying database, is READ_COMMITTED isolation implemented by forcing readers to wait for write locks to be released?

Returns:boolean

True if writers block readers to achieve READ_COMMITTED; false otherwise.

doesRepeatableReadCauseReadersToBlockWritersback to summary
public boolean doesRepeatableReadCauseReadersToBlockWriters()

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.doesRepeatableReadCauseReadersToBlockWriters.

Doc from org.hibernate.dialect.Dialect.doesRepeatableReadCauseReadersToBlockWriters.

For the underlying database, is REPEATABLE_READ isolation implemented by forcing writers to wait for read locks to be released?

Returns:boolean

True if readers block writers to achieve REPEATABLE_READ; false otherwise.

getAfterSelectInsertPointback to summary
pack-priv static int getAfterSelectInsertPoint(String sql)
getCurrentTimestampSelectStringback to summary
public String getCurrentTimestampSelectString()

Overrides org.hibernate.dialect.AbstractTransactSQLDialect.getCurrentTimestampSelectString.

Doc from org.hibernate.dialect.Dialect.getCurrentTimestampSelectString.

Retrieve the command used to retrieve the current timestamp from the database.

Returns:String

The command.

getLimitStringback to summary
public String getLimitString(String querySelect, int offset, int limit)

Overrides org.hibernate.dialect.Dialect.getLimitString.

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

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

Parameters
querySelect:String

The query to which to apply the limit.

offset:int

The offset of the limit

limit:int

The limit of the limit ;)

Returns:String

The modified query statement with the limit applied.

getNoColumnsInsertStringback to summary
public String getNoColumnsInsertString()

Overrides org.hibernate.dialect.Dialect.getNoColumnsInsertString.

Doc from org.hibernate.dialect.Dialect.getNoColumnsInsertString.

The fragment used to insert a row without specifying any column values. This is not possible on some databases.

Returns:String

The appropriate empty values clause.

openQuoteback to summary
public char openQuote()

Overrides org.hibernate.dialect.Dialect.openQuote.

Doc from org.hibernate.dialect.Dialect.openQuote.

The character specific to this dialect used to begin a quoted identifier.

Returns:char

The dialect's specific open quote character.

supportsCircularCascadeDeleteConstraintsback to summary
public boolean supportsCircularCascadeDeleteConstraints()

Overrides org.hibernate.dialect.Dialect.supportsCircularCascadeDeleteConstraints.

Doc from org.hibernate.dialect.Dialect.supportsCircularCascadeDeleteConstraints.

Does this dialect support definition of cascade delete constraints which can cause circular chains?

Returns:boolean

True if circular cascade delete constraints are supported; false otherwise.

supportsLimitback to summary
public boolean supportsLimit()

Overrides org.hibernate.dialect.Dialect.supportsLimit.

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

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

Returns:boolean

True if this dialect supports some form of LIMIT.

supportsLimitOffsetback to summary
public boolean supportsLimitOffset()

Overrides org.hibernate.dialect.Dialect.supportsLimitOffset.

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

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

Returns:boolean

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

supportsLobValueChangePropogationback to summary
public boolean supportsLobValueChangePropogation()

Overrides org.hibernate.dialect.Dialect.supportsLobValueChangePropogation.

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

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

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

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

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

Returns:boolean

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

supportsResultSetPositionQueryMethodsOnForwardOnlyCursorback to summary
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()

Overrides org.hibernate.dialect.Dialect.supportsResultSetPositionQueryMethodsOnForwardOnlyCursor.

Doc from org.hibernate.dialect.Dialect.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 java.sql.ResultSet#isAfterLast and java.sql.ResultSet#isBeforeFirst. Certain drivers do not allow access to these methods for forward only cursors.

NOTE : this is highly driver dependent!

Returns:boolean

True if methods like java.sql.ResultSet#isAfterLast and java.sql.ResultSet#isBeforeFirst are supported for forward only cursors; false otherwise.

supportsVariableLimitback to summary
public boolean supportsVariableLimit()

Overrides org.hibernate.dialect.Dialect.supportsVariableLimit.

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

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

Returns:boolean

True if bind variables can be used; false otherwise.

useMaxForLimitback to summary
public boolean useMaxForLimit()

Overrides org.hibernate.dialect.Dialect.useMaxForLimit.

Doc from org.hibernate.dialect.Dialect.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. 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)

So essentially, is limit relative from offset? Or is limit absolute?

Returns:boolean

True if limit is relative from offset; false otherwise.