Class SybaseASEDialect

All Implemented Interfaces:
CheckConstraintSupport, ForeignKeySupport, IdentifierSupport, KeywordSupport, LiteralSupport, AlterTableSupport, ColumnDefinitionSupport, ConstraintControlSupport, IndexDdlSupport, TableCreationSupport, TruncateSupport, CurrentTemporalSupport, TemporalFormatSupport, TemporalOperationSupport, ConversionContext

public class SybaseASEDialect extends SybaseDialect implements CurrentTemporalSupport, TemporalOperationSupport
A SQL dialect for Sybase Adaptive Server Enterprise 16 and above.
  • Field Details

  • Constructor Details

    • SybaseASEDialect

      public SybaseASEDialect()
    • SybaseASEDialect

      public SybaseASEDialect(DatabaseVersion version)
    • SybaseASEDialect

      public SybaseASEDialect(DialectResolutionInfo info)
  • Method Details

    • 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 AbstractTransactSQLDialect
      See Also:
    • getTemporalOperationSupport

      @SPI({IMPLEMENT,SUPPLY}) public TemporalOperationSupport getTemporalOperationSupport()
      Description copied from class: Dialect
      Supply extraction and timestamp-arithmetic syntax. Return one stable, non-null, thread-safe implementation. Providers may implement TemporalOperationSupport directly and return this.
      Overrides:
      getTemporalOperationSupport in class SybaseDialect
      See Also:
    • 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 SybaseDialect
      See Also:
    • getTypeSizingProfile

      public TypeSizingProfile getTypeSizingProfile()
      Description copied from class: Dialect

      Supplies this Dialect's resolved type-sizing limits and defaults.

      Return TypeSizingProfile.STANDARD when no dimension differs. Construct one stable immutable profile after version and server configuration are known. A family Dialect may copy its superclass profile, but must set every effective dimension which formerly changed through scalar-method delegation because profile builder setters do not cascade.

      Overrides:
      getTypeSizingProfile in class Dialect
    • determineDatabaseVersion

      @SPI({USE,IMPLEMENT}) public DatabaseVersion determineDatabaseVersion(DialectResolutionInfo info)
      Description copied from class: Dialect
      Determine the database version, as precise as possible and using Dialect-specific techniques, from a DialectResolutionInfo object.

      This method is called during superclass construction by Dialect(DialectResolutionInfo). Implementations must not depend on subclass initialization. Integration providers may also invoke this method on an existing Dialect when database metadata becomes available after the Dialect was constructed.

      Overrides:
      determineDatabaseVersion in class Dialect
      Parameters:
      info - The dialect resolution info that would be passed by Hibernate ORM to the constructor of a Dialect of the same type.
      Returns:
      The corresponding database version.
    • 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 AbstractTransactSQLDialect
    • registerColumnTypes

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

      Register the inherited ANSI-oriented DDL type descriptors during Dialect type contribution.

      Override this focused sub-hook to extend or replace column type registrations. Invoke super first to retain the inherited descriptor set; omitting it deliberately replaces that set. Mutate the supplied boot-scoped registry only during this callback, and do not retain the contribution context or registry afterward. Implement an independent TypeContributor instead when the contribution is not owned by a Dialect.

      Overrides:
      registerColumnTypes in class Dialect
      Parameters:
      typeContributions - the Hibernate-supplied contribution target
      serviceRegistry - the Hibernate-supplied bootstrap services
      See Also:
    • getPreferredSqlTypeCodeForArray

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

      Select the default SqlTypes code for a basic Java array or collection.

      Return the container type Hibernate should request when no local mapping selects one. Typical choices are SqlTypes.ARRAY, SqlTypes.TABLE, SqlTypes.JSON_ARRAY, SqlTypes.XML_ARRAY, and SqlTypes.VARBINARY. The hibernate.type.preferred_array_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:
      getPreferredSqlTypeCodeForArray in class Dialect
      Returns:
      a container 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 SybaseDialect
      Parameters:
      functionContributions - the Hibernate-supplied function contribution target
      See Also:
    • getMaximumSeriesSize

      protected int getMaximumSeriesSize()
      Sybase ASE doesn't support the generate_series function or lateral recursive CTEs, so it has to be emulated with the xmltable and replicate functions.
    • isAnsiNullOn

      public boolean isAnsiNullOn()
    • getSizeStrategy

      public SizeStrategy getSizeStrategy()
      Description copied from class: Dialect

      Supply the strategy which resolves column sizes for mapped Java and JDBC types.

      Return the standard strategy unless this database changes column-size resolution. For focused deviations, construct a stable StandardSizeStrategy with this Dialect, override the affected cases, and delegate all other cases to the standard implementation. The result must be non-null and stable for the lifetime of this Dialect.

      Overrides:
      getSizeStrategy in class Dialect
    • getSqlAstTranslatorFactory

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

      Supply the factory for this Dialect's single-use SQL AST translators.

      Return null to use StandardSqlAstTranslatorFactory. A custom Dialect should normally return a reusable factory derived from that class and create translators derived from AbstractSqlAstTranslator or an appropriate supported family base. The factory must not retain translation requests, and every translator it returns is used for one translation.

      Overrides:
      getSqlAstTranslatorFactory in class SybaseDialect
      See Also:
    • getAggregateSupport

      @SPI({IMPLEMENT,SUPPLY}) public AggregateSupport getAggregateSupport()
      Description copied from class: Dialect
      Supply the aggregate-column mapping, DDL, read, assignment, and write behavior for this dialect. Override this method to return a provider implementation of AggregateSupport, or retain the standard behavior returned by the default.
      Overrides:
      getAggregateSupport in class Dialect
      Returns:
      this dialect's aggregate support
      See Also:
    • getPredicateSupport

      public PredicateSupport getPredicateSupport()
      Description copied from class: Dialect

      The database's native predicate syntax and predicate-placement profile.

      Override this method to supply independent support for a native case-insensitive-like operator, scalar distinct from, truthness predicates, and predicates used as value expressions. An absent case-insensitive-like operator selects Hibernate's lowercase-expression emulation. Return one immutable, non-null profile whose values remain stable for the lifetime of this Dialect; do not override individual consumers to reproduce these decisions.

      Overrides:
      getPredicateSupport in class Dialect
      Returns:
      this Dialect's stable predicate-support profile
    • 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 SybaseDialect
      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.

    • currentDate

      @SPI({USE,IMPLEMENT}) public String currentDate()
      Description copied from interface: CurrentTemporalSupport
      Render the current SQL date expression.
      Specified by:
      currentDate in interface CurrentTemporalSupport
    • currentTime

      @SPI({USE,IMPLEMENT}) public String currentTime()
      Description copied from interface: CurrentTemporalSupport
      Render the current SQL time expression used for java.sql.Time.
      Specified by:
      currentTime in interface CurrentTemporalSupport
    • currentTimestamp

      @SPI({USE,IMPLEMENT}) public String currentTimestamp()
      Description copied from interface: CurrentTemporalSupport
      Render the current SQL timestamp expression used for java.sql.Timestamp.
      Specified by:
      currentTimestamp in interface CurrentTemporalSupport
      Overrides:
      currentTimestamp in class SybaseDialect
    • fractionalSecondPrecisionInNanos

      @SPI({USE,IMPLEMENT}) public long fractionalSecondPrecisionInNanos()
      Sybase ASE in principle supports microsecond precision for {code bigdatetime}, but unfortunately its duration arithmetic functions have a nasty habit of overflowing. So to give ourselves a little extra headroom, we will use millisecond as the native unit of precision.
      Specified by:
      fractionalSecondPrecisionInNanos in interface TemporalOperationSupport
    • timestampaddPattern

      @SPI({USE,IMPLEMENT}) public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType)
      Description copied from interface: TemporalOperationSupport
      Return a timestamp-add pattern containing ?1, ?2, and ?3.
      Specified by:
      timestampaddPattern in interface TemporalOperationSupport
      Overrides:
      timestampaddPattern in class SybaseDialect
    • timestampdiffPattern

      @SPI({USE,IMPLEMENT}) public String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType)
      Description copied from interface: TemporalOperationSupport
      Return a timestamp-difference pattern containing ?1, ?2, and ?3.
      Specified by:
      timestampdiffPattern in interface TemporalOperationSupport
      Overrides:
      timestampdiffPattern in class SybaseDialect
    • contributeKeywords

      @SPI({USE,IMPLEMENT,SUPPLY}) protected void contributeKeywords(KeywordRegistration registration)
      Description copied from class: Dialect

      Contribute ANSI and database-specific SQL keywords.

      Invoke super first to retain the SQL:2003 words. Omitting super deliberately replaces the inherited keyword profile. Register words only during this callback and do not retain the registration target.

      Overrides:
      contributeKeywords in class Dialect
      Parameters:
      registration - the scoped keyword target
    • supportsOnDeleteAction

      @SPI({USE,IMPLEMENT}) public boolean supportsOnDeleteAction(OnDeleteAction action)
      Specified by:
      supportsOnDeleteAction in interface ForeignKeySupport
    • getMaxAliasLength

      @SPI({USE,IMPLEMENT}) public int getMaxAliasLength()
      Description copied from interface: IdentifierSupport
      Return the safe maximum length of a generated SQL alias, including room for Hibernate's generated suffix.
      Specified by:
      getMaxAliasLength in interface IdentifierSupport
    • getMaxIdentifierLength

      @SPI({USE,IMPLEMENT}) public int getMaxIdentifierLength()
      Description copied from interface: IdentifierSupport
      Return the database's maximum identifier length.
      Specified by:
      getMaxIdentifierLength in interface IdentifierSupport
      Overrides:
      getMaxIdentifierLength in class SybaseDialect
    • getLockingSupport

      public LockingSupport getLockingSupport()
      Description copied from class: Dialect

      Supplies the cohesive pessimistic-locking profile for this Dialect.

      The profile coordinates capability metadata, statement-clause rendering, table hints, already-rendered SQL rewriting, connection timeout handling, and follow-on locking. A custom Dialect should supply one internally consistent profile instead of overriding those behaviors independently. The returned support must be non-null and stable for the Dialect lifetime; its components may be reused concurrently and must not retain per-query requests.

      Overrides:
      getLockingSupport in class SybaseDialect
      See Also:
    • getSubquerySupport

      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 AbstractTransactSQLDialect
      Returns:
      this Dialect's stable subquery-support profile
    • getSetOperationSupport

      public SetOperationSupport getSetOperationSupport()
      Description copied from class: Dialect

      Supplies the database's set operators and structural query-group capabilities.

      Return one non-null, immutable profile whose values remain stable for this Dialect's lifetime. Declare each SetOperator independently; support for a distinct operator never implies its ALL form. Structural capabilities such as UNION placement in subqueries are separate from operator support. Continue to override Dialect.getSetOperatorSqlString(SetOperator) when an operator requires database-specific spelling. When refining a family Dialect, start from SetOperationSupport.builder(super.getSetOperationSupport()) and change only the differing values.

      Overrides:
      getSetOperationSupport in class Dialect
      Returns:
      this Dialect's stable set-operation profile
    • tableCreationOptions

      @SPI({USE,IMPLEMENT}) public String tableCreationOptions()
      Specified by:
      tableCreationOptions in interface TableCreationSupport
    • toQuotedIdentifier

      public String toQuotedIdentifier(String name)
      Description copied from interface: IdentifierSupport
      Render a complete quoted identifier, preserving null.
      Specified by:
      toQuotedIdentifier in interface IdentifierSupport
    • getViolatedConstraintNameExtractor

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

      Supplies the extractor used to recover violated constraint names from database exceptions.

      The extractor returns null when a name cannot be recovered. Do not use an empty string or sentinel to represent absence.

      Specified by:
      getViolatedConstraintNameExtractor in interface ConversionContext
      Overrides:
      getViolatedConstraintNameExtractor in class Dialect
      Returns:
      the non-null constraint-name extractor
      See Also:
    • causesRollback

      public boolean causesRollback(SQLException sqlException)
      Description copied from class: Dialect

      Determine whether this database marks the current transaction for rollback after the given statement failure.

      Inspect the original database exception when the policy depends on its error code, SQL state, or subtype. This decision is independent of how Hibernate converts the exception. This determines both JDBC rollback state and whether a pessimistic lock failure becomes a JPA PessimisticLockException or LockTimeoutException.

      Overrides:
      causesRollback in class Dialect
      Parameters:
      sqlException - the original database exception
      Returns:
      true when the failed statement invalidates the transaction
    • buildSQLExceptionConversionDelegate

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

      Supplies vendor-specific SQL-exception conversion for this Dialect.

      The returned delegate runs in addition to Hibernate's standard JDBC exception-hierarchy and SQL-state delegates. Its null result means that it declined the exception so conversion may continue. Return null from this method when the Dialect has no vendor-specific delegate.

      Prefer stable vendor error codes or SQL states and preserve the original SQLException.

      Overrides:
      buildSQLExceptionConversionDelegate in class Dialect
      Returns:
      the vendor conversion delegate, or null when none is supplied
      See Also:
    • getLimitHandler

      public LimitHandler getLimitHandler()
      Description copied from class: Dialect

      Supplies execution-time pagination for already-rendered SQL requested by Query.setMaxResults(int) or Query.setFirstResult(int).

      This is distinct from SQL AST PaginationRenderingSupport, which handles offset and fetch clauses represented in the semantic tree. A custom Dialect should normally return a stock LimitHandler or extend a supported handler family. The returned handler may be reused concurrently and must not retain per-query state.

      Overrides:
      getLimitHandler in class Dialect
      Returns:
      a non-null handler
    • getSingleRowTableSupport

      public SingleRowTableSupport getSingleRowTableSupport()
      Description copied from class: Dialect

      Supply the SQL renderings used for a reusable single-row table and for an otherwise table-less select.

      Override this method with one stable, non-null profile when either rendering differs from SingleRowTableSupport.STANDARD. The table expression and the complete select-only from fragment are independent; an empty fragment means that no from clause is required. Dialect subclasses refining a family profile should copy Dialect.getSingleRowTableSupport() from the superclass and change only the values which differ.

      Overrides:
      getSingleRowTableSupport in class Dialect
      Returns:
      the stable, non-null single-row-table-support profile
    • getValuesListSupport

      public ValuesListSupport getValuesListSupport()
      Description copied from class: Dialect

      The contexts in which this Dialect supports native multi-row values syntax.

      The returned immutable profile must be non-null and stable for the lifetime of this Dialect. Report only native syntax support; translator emulation is selected separately.

      Overrides:
      getValuesListSupport in class SybaseDialect
    • getMutationSyntaxSupport

      public MutationSyntaxSupport getMutationSyntaxSupport()
      Description copied from class: Dialect

      The native SQL mutation-syntax capabilities of this Dialect.

      The returned immutable profile must be non-null and stable for the lifetime of this Dialect. Report syntax which the translator may use directly; do not report a capability merely because it can be emulated. QueryMutationRenderingSupport consumes this profile when selecting a native or emulated plan.

      Overrides:
      getMutationSyntaxSupport in class SybaseDialect
    • supportsCrossJoin

      public boolean supportsCrossJoin()
      Description copied from class: Dialect

      Whether this database supports ANSI cross join syntax.

      Return a stable answer for this Dialect's lifetime. A false result directs SQL AST rendering to use its unqualified join with a true predicate and is independent of the database's Dialect.getSingleRowTableSupport() profile.

      Overrides:
      supportsCrossJoin in class Dialect