Class AbstractTransactSQLDialect

java.lang.Object
org.hibernate.dialect.Dialect
org.hibernate.dialect.AbstractTransactSQLDialect
All Implemented Interfaces:
CheckConstraintSupport, ForeignKeySupport, IdentifierSupport, KeywordSupport, LiteralSupport, AlterTableSupport, ColumnDefinitionSupport, ConstraintControlSupport, IndexDdlSupport, TableCreationSupport, TruncateSupport, CurrentTemporalSupport, TemporalOperationSupport, ConversionContext
Direct Known Subclasses:
SQLServerDialect, SybaseDialect

@SPI({USE,IMPLEMENT}) public abstract class AbstractTransactSQLDialect extends Dialect implements CurrentTemporalSupport

A supported base for provider Dialects derived from the Transact-SQL family, including Sybase and Microsoft SQL Server variants.

Provider subclasses must invoke a protected constructor classified IMPLEMENT. The generated SPI inventory identifies the constructors and members covered by this type-level implementation contract; unclassified implementation details are not provider extension points.

  • Constructor Details

  • Method Details

    • getCurrentTemporalSupport

      @SPI({IMPLEMENT,SUPPLY}) public CurrentTemporalSupport getCurrentTemporalSupport()
      Description copied from class: Dialect
      Supply current temporal expressions and database-side timestamp retrieval. Return one stable, non-null, thread-safe implementation. Providers may implement CurrentTemporalSupport directly and return this.
      Overrides:
      getCurrentTemporalSupport in class Dialect
      See Also:
    • columnType

      @SPI({USE,IMPLEMENT}) protected String columnType(int sqlTypeCode)
      Description copied from class: Dialect

      Return the complete database column declaration pattern for a JDBC Types or Hibernate SqlTypes code used during type registration.

      Use only $l, $p, and $s for length, precision, and scale. Define distinct mappings for the LONG32 codes; the JDBC LONG synonyms are normalized before this hook. Delegate unknown inherited codes to the superclass so its standard exception remains authoritative.

      Overrides:
      columnType in class Dialect
    • contributeTypes

      @SPI({IMPLEMENT,SUPPLY}) public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
      Description copied from class: Dialect

      Contribute database-specific Java, JDBC, DDL, and basic type descriptors.

      Override this method when the database or JDBC driver requires descriptors beyond the inherited registrations. Invoke super first unless the Dialect intentionally replaces the complete inherited contribution protocol. Obtain reusable dialect-specific JDBC descriptors from the family facades in org.hibernate.dialect.type.spi, and preserve whether a descriptor replaces an existing registration or is added only when absent.

      Overrides:
      contributeTypes in class Dialect
      Parameters:
      typeContributions - the Hibernate-supplied contribution registry
      serviceRegistry -

      the Hibernate-supplied services, including class loading used by driver-backed descriptor factories

      Mutate the supplied boot-scoped registries only during this callback and do not retain the contribution context or a mutable registry afterward. Implement an independent TypeContributor instead when the contribution is not owned by a Dialect.

    • contributeDefaultProperties

      @SPI({IMPLEMENT,SUPPLY}) protected void contributeDefaultProperties(Properties properties)
      Description copied from class: Dialect

      Contribute provider configuration defaults after Dialect construction.

      Invoke super first to extend the inherited defaults. Omitting super deliberately replaces them. Mutate the supplied isolated property bag only during this callback; do not retain it or call Dialect.getDefaultProperties() from a Dialect constructor.

      Overrides:
      contributeDefaultProperties in class Dialect
      Parameters:
      properties - the isolated contribution target
    • resolveSqlTypeDescriptor

      @SPI({USE,IMPLEMENT}) public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
      Description copied from class: Dialect

      Resolve the non-null JDBC descriptor for result-set metadata.

      Preserve vendor replacement and array-component resolution, and delegate unmatched codes to jdbcTypeRegistry.

      Overrides:
      resolveSqlTypeDescriptor in class Dialect
    • getPreferredSqlTypeCodeForBoolean

      @SPI({IMPLEMENT,SUPPLY}) public int getPreferredSqlTypeCodeForBoolean()
      Description copied from class: Dialect

      Select the default SqlTypes code for Java boolean mappings.

      Return a Boolean-compatible code such as SqlTypes.BOOLEAN, SqlTypes.BIT, SqlTypes.SMALLINT, SqlTypes.TINYINT, or SqlTypes.INTEGER. The hibernate.type.preferred_boolean_jdbc_type setting takes precedence over this Dialect default. This method selects a type code; contribute a JDBC descriptor or customize DDL rendering through their dedicated contracts.

      Overrides:
      getPreferredSqlTypeCodeForBoolean in class Dialect
      Returns:
      a Boolean-compatible type code defined by SqlTypes
      See Also:
    • initializeFunctionRegistry

      @SPI({IMPLEMENT,SUPPLY}) public void initializeFunctionRegistry(FunctionContributions functionContributions)
      Description copied from class: Dialect

      Contribute the database-specific function descriptors after independent function contributors have run.

      Override this callback to extend or replace the inherited function set. Invoke super first to retain Hibernate's standard and emulated registrations; omitting it deliberately replaces that set. Mutate the supplied boot-scoped function registry only during this callback, and do not retain the contribution context or registry afterward. Implement an independent FunctionContributor instead when the contribution is not owned by a Dialect.

      Overrides:
      initializeFunctionRegistry in class Dialect
      Parameters:
      functionContributions - the Hibernate-supplied function contribution target
      See Also:
    • trimPattern

      @SPI({USE,IMPLEMENT}) public String trimPattern(TrimSpec specification, boolean isWhitespace)
      Description copied from class: Dialect
      Obtain a pattern for the SQL equivalent to a trim() function call. The resulting pattern must contain a ?1 placeholder for the argument of type String and a ?2 placeholder for the trim character if isWhitespace was false.
      Overrides:
      trimPattern in class Dialect
      Parameters:
      specification - leading, trailing, or both
      isWhitespace - true if trimming whitespace, and the ?2 placeholder for the trim character should be omitted, false if the trim character is explicit and the ?2 placeholder must be included in the pattern
    • replaceLtrimRtrim

      public static String replaceLtrimRtrim(TrimSpec specification, boolean isWhitespace)
    • addColumnPrefix

      @SPI({USE,IMPLEMENT}) public String addColumnPrefix()
      Specified by:
      addColumnPrefix in interface AlterTableSupport
    • nameQualification

      @SPI({USE,IMPLEMENT}) public IndexNameQualification nameQualification()
      Specified by:
      nameQualification in interface IndexDdlSupport
    • getLockingClauseStrategy

      public LockingClauseStrategy getLockingClauseStrategy(QuerySpec querySpec, LockOptions lockOptions)
      Description copied from class: Dialect
      Supplies the per-translation strategy for a statement-level [PessimisticLockStyle#CLAUSE locking clause].
      Overrides:
      getLockingClauseStrategy in class Dialect
      See Also:
    • getCurrentTimestampSelection

      @SPI({USE,IMPLEMENT}) public CurrentTimestampSelection getCurrentTimestampSelection()
      Description copied from interface: CurrentTemporalSupport
      Select the JDBC command used for database-side current timestamp retrieval, or return null when the database offers no supported command.
      Specified by:
      getCurrentTimestampSelection in interface CurrentTemporalSupport
      See Also:
    • getNullOrderingSupport

      public NullOrderingSupport getNullOrderingSupport()
      Description copied from class: Dialect

      Supply the database's default null ordering and explicit null-precedence syntax capabilities.

      Override this method with a stable, non-null profile when the database's default null placement differs from NullOrderingSupport.STANDARD, or when it cannot render nulls first and nulls last natively. Dialect subclasses refining a family profile should copy Dialect.getNullOrderingSupport() from the superclass and change only the values which differ.

      Overrides:
      getNullOrderingSupport in class Dialect
      Returns:
      the stable, non-null null-ordering-support profile
    • getExpressionCoercionSupport

      @SPI({IMPLEMENT,SUPPLY}) public ExpressionCoercionSupport getExpressionCoercionSupport()
      Description copied from class: Dialect

      Supplies the expression-coercion adaptations required by this database.

      Return one non-null, immutable profile whose values remain stable for this Dialect's lifetime. Each requirement directs a focused rendering adaptation; it does not report general database cast support. When refining a family Dialect, start from ExpressionCoercionSupport.builder(super.getExpressionCoercionSupport()) and change only the differing requirement.

      Overrides:
      getExpressionCoercionSupport in class Dialect
      Returns:
      this Dialect's stable expression-coercion requirement profile
    • getMultiTableMutationSupport

      public MultiTableMutationSupport getMultiTableMutationSupport()
      Description copied from class: Dialect

      Select the Hibernate-owned fallback families used for SQM update/delete and insert operations targeting entities mapped to multiple tables.

      A custom Dialect should return one of the named profiles when both operation families use the same strategy kind, or construct an asymmetric profile when they differ. Local, global, and persistent-table selections require the corresponding non-null temporary-table strategy, while CTE requires non-query CTE support.

      Configured global and entity-specific custom strategies take precedence over this fallback. Supply a custom execution implementation with QuerySettings.QUERY_MULTI_TABLE_MUTATION_STRATEGY or QuerySettings.QUERY_MULTI_TABLE_INSERT_STRATEGY instead of depending on Hibernate's internal fallback implementations.

      Overrides:
      getMultiTableMutationSupport in class Dialect
      Returns:
      a stable, non-null fallback selection profile
    • getLocalTemporaryTableStrategy

      public TemporaryTableStrategy getLocalTemporaryTableStrategy()
      Description copied from class: Dialect

      Supplies this Dialect's local temporary-table strategy.

      Return null when the database has no supported local temporary-table form. A non-null strategy must be stable for the Dialect lifetime and consistent with Dialect.getTemporaryTableExporter().

      Overrides:
      getLocalTemporaryTableStrategy in class Dialect
    • getSubquerySupport

      @SPI({IMPLEMENT,SUPPLY}) public SubquerySupport getSubquerySupport()
      Description copied from class: Dialect

      Supplies the database's supported subquery placements.

      Return one non-null, immutable profile whose values remain stable for this Dialect's lifetime. Declare every placement independently. In particular, scalar subqueries in the select list and exists predicates in the select list are separate capabilities. Lateral spelling and fallback rendering remain translator responsibilities. When refining a family Dialect, start from SubquerySupport.builder(super.getSubquerySupport()) and change only the differing placements.

      Overrides:
      getSubquerySupport in class Dialect
      Returns:
      this Dialect's stable subquery-support profile
    • getTupleCountSupport

      public TupleCountSupport getTupleCountSupport()
      Description copied from class: Dialect

      Supplies the database syntax for ordinary and distinct tuple counts.

      Return one non-null, immutable profile whose values remain stable for this Dialect's lifetime. Select TupleCountSupport.Syntax.UNSUPPORTED to use Hibernate's existing emulation, TupleCountSupport.Syntax.ARGUMENT_LIST for syntax such as count(a, b), or TupleCountSupport.Syntax.PARENTHESIZED_TUPLE for syntax such as count((a, b)). Configure the ordinary and distinct forms independently; a database may require different forms for them. When refining a family Dialect, copy Dialect.getTupleCountSupport() from the superclass and replace only the differing syntax choice.

      Overrides:
      getTupleCountSupport in class Dialect
      Returns:
      the non-null tuple-count-syntax profile
    • getIdentityColumnSupport

      @SPI({IMPLEMENT,SUPPLY}) public IdentityColumnSupport getIdentityColumnSupport()
      Supply the common Transact-SQL identity profile. Subclasses may override this profile when their identity declaration or retrieval SQL differs.
      Overrides:
      getIdentityColumnSupport in class Dialect
      Since:
      8.0
    • appendBinaryLiteral

      @SPI({USE,IMPLEMENT}) public void appendBinaryLiteral(SqlAppender appender, byte[] bytes)
      Description copied from interface: LiteralSupport
      Append a SQL binary literal.
      Specified by:
      appendBinaryLiteral in interface LiteralSupport