Class MySQLDialect
- All Implemented Interfaces:
CheckConstraintSupport, ForeignKeySupport, IdentifierSupport, KeywordSupport, LiteralSupport, AlterTableSupport, ColumnDefinitionSupport, ConstraintControlSupport, IndexDdlSupport, TableCreationSupport, TruncateSupport, CurrentTemporalSupport, TemporalFormatSupport, TemporalOperationSupport, ConversionContext
- Direct Known Subclasses:
MariaDBDialect, MySQL56SpatialDialect, MySQL5SpatialDialect, MySQLSpatialDialect
A SQL dialect for MySQL 8 and above.
Please refer to the MySQL documentation.
This class is also the supported family base for provider Dialects derived
from MySQL. Provider subclasses must invoke a 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.
- Since:
- 8.0
-
Field Summary
Fields inherited from class Dialect
LEGACY_LOB_MERGE_STRATEGY, NEW_LOCATOR_LOB_MERGE_STRATEGY, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGYFields inherited from interface ConstraintControlSupport
NONEFields inherited from interface TruncateSupport
STANDARD -
Constructor Summary
ConstructorsConstructorDescriptionMySQLDialect(DatabaseVersion version) MySQLDialect(DatabaseVersion version, MySQLServerConfiguration serverConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether every table partition key must also occur in its primary key.alterColumnType(AlterColumnTypeRequest request) voidappendBooleanValueString(SqlAppender appender, boolean bool) Append a SQL Boolean literal expression.voidappendDateTimeLiteral(SqlAppender appender, TemporalAccessor temporalAccessor, TemporalType precision, TimeZone jdbcTimeZone) Append a datetime literal for ajava.timevalue.voidappendDateTimeLiteral(SqlAppender appender, Calendar calendar, TemporalType precision, TimeZone jdbcTimeZone) Append a datetime literal for aCalendarvalue.voidappendDateTimeLiteral(SqlAppender appender, Date date, TemporalType precision, TimeZone jdbcTimeZone) Append a datetime literal for a legacyDatevalue.voidappendDefinition(SqlAppender appender, ColumnDefinitionRequest request) voidappendFormat(SqlAppender appender, String format) Append the database translation of the supplied Hibernate format pattern.voidappendLiteral(SqlAppender appender, String literal) Append a SQL string literal.Build and supply the configured identifier helper from the stable JDBC metadata snapshot and selected keyword strategy.Supplies vendor-specific SQL-exception conversion for this Dialect.castPattern(CastType from, CastType to) Obtain a pattern for the SQL equivalent to acast()function call.protected StringcastType(int sqlTypeCode) Return the complete cast-target type pattern forsqlTypeCode.booleancausesRollback(SQLException sqlException) Determine whether this database marks the current transaction for rollback after the given statement failure.charReturn the character which closes a quoted identifier.protected StringcolumnType(int sqlTypeCode) protected voidcontributeKeywords(KeywordRegistration registration) Contribute ANSI and database-specific SQL keywords.voidcontributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) Contribute database-specific Java, JDBC, DDL, and basic type descriptors.Creates the JDBC mutation operation for an optional-table update.protected static DatabaseVersioncreateVersion(DialectResolutionInfo info, DatabaseVersion defaultVersion) MySQL 5.7 precision defaults to seconds, but microseconds is betterstatic ReplacerdatetimeFormat(String format) extractPattern(TemporalUnit unit) MySQL supports a limited list of temporal fields in the extract() function, but we can emulate some of them by using the appropriate named functions instead of extract().longmicrosecondis the smallest unit fortimestampadd()andtimestampdiff(), and the highest precision for atimestamp.Supply the aggregate-column mapping, DDL, read, assignment, and write behavior for this dialect.The common-table-expression capabilities of this Dialect.Supply current temporal expressions and database-side timestamp retrieval.Select the JDBC command used for database-side current timestamp retrieval, or returnnullwhen the database offers no supported command.protected MySQLStorageEngineSelect the storage engine used when none is explicitly configured.Supply direct JDBC access capabilities for Java Time classes.The qualifier form accepted for target-column references in update and delete statements.Supply the database's finite-domain declaration, lifecycle, and check strategy.The database's support for recognizing primary-key functional dependency ingroup byandorder byclauses.Supply the stable identity-column DDL, insert syntax, and identity-specific retrieval behavior for this Dialect.Supply existence-check placement for schema DDL targets.getInformationExtractor(ExtractionContext extractionContext) Supply the context-bound strategy Hibernate uses to discover database tables, keys, indexes, and related schema metadata.Supplies execution-time pagination for already-rendered SQL requested byQuery.setMaxResults(int)orQuery.setFirstResult(int).Supply the database and driver policy for LOB creation, binding, materialization, type classification, mutation ordering, and VALUE LOB DDL.Supplies this Dialect's local temporary-table strategy.Supplies the cohesive pessimistic-locking profile for this Dialect.intReturn the safe maximum length of a generated SQL alias, including room for Hibernate's generated suffix.intReturn the database's maximum identifier length.protected intMySQL doesn't support thegenerate_seriesfunction orlateralrecursive CTEs, so it has to be emulated with a top level recursive CTE which requires an upper bound on the amount of elements that the series can return.protected DatabaseVersionGet the version of the SQL dialect that is the minimum supported by this implementation.Select the Hibernate-owned fallback families used for SQM update/delete and insert operations targeting entities mapped to multiple tables.The native SQL mutation-syntax capabilities of this Dialect.Supply catalog and schema qualification support, or returnnullto useDatabaseMetaData.Treat MySQL databases as catalogs for namespace lifecycle operations.Supply the database's default null ordering and explicit null-precedence syntax capabilities.Supply the JDBC strategy for binding an untyped Javanull.The database's native predicate syntax and predicate-placement profile.intSelect the defaultSqlTypescode for a basic Java array or collection.intSelect the defaultSqlTypescode for Javabooleanmappings.getQueryHintString(String query, String hints) Apply a hint to the given SQL query.The native row-value syntax of this Dialect.Supply schema-export support for comments attached to database objects.Supply schema-drop composition and ordered pre-drop commands.No support for sequences.Supplies the database's set operators and structural query-group capabilities.Supply the SQL renderings used for a reusable single-row table and for an otherwise table-less select.Supply the strategy which resolves column sizes for mapped Java and JDBC types.Supply the factory for this Dialect's single-use SQL AST translators.Supply the database's stable string-value semantics.Supplies the database's supported subquery placements.Supply datetime-format translation.Supply extraction and timestamp-arithmetic syntax.Supplies the complete temporal-table DDL and historical-query strategy for this Dialect.Supply temporal precision-adjustment and literal-offset semantics.Supplies this Dialect's resolved type-sizing limits and defaults.Supply the stable strategy used for unique-key representation and DDL.Supplies the extractor used to recover violated constraint names from database exceptions.Supplies the native window-function syntax supported by this database.voidinitializeFunctionRegistry(FunctionContributions functionContributions) Contribute the database-specific function descriptors after independent function contributors have run.booleanIs JDBC statement warning logging enabled by default?booleancharReturn the character which opens a quoted identifier.protected voidregisterColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) Register the inherited ANSI-oriented DDL type descriptors during Dialect type contribution.protected static voidregisterJsonFunctions(CommonFunctionFactory functionFactory) render(CheckConstraintRenderRequest request) booleanresolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry) Resolve the non-null JDBC descriptor for result-set metadata.intresolveSqlTypeLength(String columnTypeName, int jdbcTypeCode, int precision, int scale, int displaySize) Normalize JDBC result-set metadata to Hibernate's resolved column length.booleansupports(CheckConstraintPlacement placement) protected booleanprotected booleanbooleansupportsOnDeleteAction(OnDeleteAction action) timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType) Return a timestamp-add pattern containing?1,?2, and?3.timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType) Return a timestamp-difference pattern containing?1,?2, and?3.Methods inherited from class Dialect
appendArrayLiteral, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildLockingClauseStrategy, buildStringToBooleanCast, buildStringToBooleanCastDecode, contributeDefaultProperties, defaultScrollMode, determineDatabaseVersion, equivalentTypes, getAlterTableSupport, getArraySupport, getArrayTypeName, getBatchLoadSizingStrategy, getCallableStatementSupport, getCatalogSeparator, getCheckConstraintSupport, getColumnAliasExtractor, getColumnDefinitionSupport, getConstraintControlSupport, getDefaultOrdinalityColumnName, getDefaultProperties, getEntityLockingStrategyFactory, getExpressionCoercionSupport, getFetchClauseSupport, getForeignKeyExporter, getForeignKeySupport, getGeneratedValuesSupport, getGlobalTemporaryTableStrategy, getIdentifierSupport, getIndexDdlSupport, getIndexExporter, getJdbcMetadataOverrides, getKeywords, getKeywordSupport, getLiteralSupport, getLobMergeStrategy, getLockingClauseStrategy, getLowercaseFunction, getMultiKeyLoadSizingStrategy, getNationalizationSupport, getNativeParameterMarkerStrategy, getNativeValueGenerationStrategy, getParameterLimits, getPersistentTemporaryTableStrategy, getQueryHintPlacement, getQueryHintString, getRefCursorSupportFactory, getRowIdSupport, getRowLevelSecurity, getSchemaNameResolver, getSelectClauseNullString, getSequenceExporter, getSequenceInformationExtractor, getSetOperatorSqlString, getSyntheticTableGroupSupport, getTableCleaner, getTableCreationSupport, getTableExporter, getTableMigrator, getTemporaryTableExporter, getTimeZoneSupport, getTruncateSupport, getTupleCountSupport, getUserDefinedTypeExporter, getValuesListSupport, getVersion, narrowCastType, resolveSqlTypeCode, resolveSqlTypeCode, supportsCrossJoin, supportsFilterClause, supportsNationalizedMethods, supportsOrdinalSelectItemReference, supportsUserDefinedTypes, throttleDdl, toString, trimPattern, truncateModeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AlterTableSupport
addColumnPrefix, addColumnSuffix, alterTableCommandMethods inherited from interface ConstraintControlSupport
disableConstraintCommands, enableConstraintCommandsMethods inherited from interface CurrentTemporalSupport
currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestampWithTimeZone, isCurrentTimestampStable, usesStandardCurrentTimestampFunctionMethods inherited from interface ForeignKeySupport
supportsAlterTableConstraintsMethods inherited from interface IdentifierSupport
quote, quoteCollation, toQuotedIdentifierMethods inherited from interface IndexDdlSupport
createCommand, createTailMethods inherited from interface KeywordSupport
acceptsJdbcKeywordMethods inherited from interface LiteralSupport
appendBinaryLiteral, appendIntervalLiteral, appendIntervalLiteral, appendUUIDLiteral, toBooleanValueStringMethods inherited from interface TableCreationSupport
createTableCommand, requiresViewColumnListMethods inherited from interface TemporalOperationSupport
translateDurationField, translateExtractFieldMethods inherited from interface TruncateSupport
renderCommands
-
Constructor Details
-
MySQLDialect
-
MySQLDialect
-
MySQLDialect
@SPI(IMPLEMENT) public MySQLDialect(DatabaseVersion version, MySQLServerConfiguration serverConfiguration) -
MySQLDialect
-
-
Method Details
-
getDirectJavaTimeJdbcSupport
Description copied from class:DialectSupply direct JDBC access capabilities for Java Time classes. Return one stable, non-null, thread-safe implementation.- Overrides:
getDirectJavaTimeJdbcSupportin classDialect- Returns:
- the direct Java Time JDBC support for this Dialect and driver
- See Also:
-
getTemporalOperationSupport
Description copied from class:DialectSupply extraction and timestamp-arithmetic syntax. Return one stable, non-null, thread-safe implementation. Providers may implementTemporalOperationSupportdirectly and returnthis.- Overrides:
getTemporalOperationSupportin classDialect- See Also:
-
getTemporalFormatSupport
Description copied from class:DialectSupply datetime-format translation. Return one stable, non-null, thread-safe implementation.- Overrides:
getTemporalFormatSupportin classDialect- See Also:
-
getCurrentTemporalSupport
Description copied from class:DialectSupply current temporal expressions and database-side timestamp retrieval. Return one stable, non-null, thread-safe implementation. Providers may implementCurrentTemporalSupportdirectly and returnthis.- Overrides:
getCurrentTemporalSupportin classDialect- See Also:
-
getTypeSizingProfile
Description copied from class:DialectSupplies this Dialect's resolved type-sizing limits and defaults.
Return
TypeSizingProfile.STANDARDwhen 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:
getTypeSizingProfilein classDialect
-
createVersion
protected static DatabaseVersion createVersion(DialectResolutionInfo info, DatabaseVersion defaultVersion) -
getMinimumSupportedVersion
Description copied from class:DialectGet the version of the SQL dialect that is the minimum supported by this implementation.This method is called during superclass construction. Implementations must return construction-safe immutable data and must not depend on subclass initialization.
- Overrides:
getMinimumSupportedVersionin classDialect
-
columnType
Description copied from class:DialectReturn the complete database column declaration pattern for a JDBC
Typesor HibernateSqlTypescode used during type registration.Use only
$l,$p, and$sfor length, precision, and scale. Define distinct mappings for theLONG32codes; the JDBCLONGsynonyms are normalized before this hook. Delegate unknown inherited codes to the superclass so its standard exception remains authoritative.- Overrides:
columnTypein classDialect
-
getLobSupport
Description copied from class:DialectSupply the database and driver policy for LOB creation, binding, materialization, type classification, mutation ordering, and VALUE LOB DDL. Return one stable, thread-safe strategy for this Dialect.- Overrides:
getLobSupportin classDialect- Returns:
- the non-null LOB support strategy
- See Also:
-
getStringValueSemantics
Description copied from class:DialectSupply the database's stable string-value semantics.- Overrides:
getStringValueSemanticsin classDialect- Returns:
- the non-null string-value profile
- See Also:
-
appendBooleanValueString
Description copied from interface:LiteralSupportAppend a SQL Boolean literal expression.- Specified by:
appendBooleanValueStringin interfaceLiteralSupport
-
castType
Description copied from class:DialectReturn the complete cast-target type pattern for
sqlTypeCode.Override this hook when cast syntax differs from column declaration syntax; otherwise delegate to
Dialect.columnType(int). -
registerColumnTypes
@SPI({IMPLEMENT,SUPPLY}) protected void registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) Description copied from class:DialectRegister the inherited ANSI-oriented DDL type descriptors during Dialect type contribution.
Override this focused sub-hook to extend or replace column type registrations. Invoke
superfirst 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 independentTypeContributorinstead when the contribution is not owned by a Dialect.- Overrides:
registerColumnTypesin classDialect- Parameters:
typeContributions- the Hibernate-supplied contribution targetserviceRegistry- the Hibernate-supplied bootstrap services- See Also:
-
getAggregateSupport
Description copied from class:DialectSupply the aggregate-column mapping, DDL, read, assignment, and write behavior for this dialect. Override this method to return a provider implementation ofAggregateSupport, or retain the standard behavior returned by the default.- Overrides:
getAggregateSupportin classDialect- Returns:
- this dialect's aggregate support
- See Also:
-
isNoBackslashEscapesEnabled
public boolean isNoBackslashEscapesEnabled() -
appendDefinition
@SPI({USE,IMPLEMENT}) public void appendDefinition(SqlAppender appender, ColumnDefinitionRequest request) - Specified by:
appendDefinitionin interfaceColumnDefinitionSupport
-
getMySQLVersion
-
getSizeStrategy
Description copied from class:DialectSupply 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
StandardSizeStrategywith 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:
getSizeStrategyin classDialect
-
resolveSqlTypeDescriptor
@SPI({USE,IMPLEMENT}) public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry) Description copied from class:DialectResolve the non-null JDBC descriptor for result-set metadata.
Preserve vendor replacement and array-component resolution, and delegate unmatched codes to
jdbcTypeRegistry.- Overrides:
resolveSqlTypeDescriptorin classDialect
-
resolveSqlTypeLength
@SPI({USE,IMPLEMENT}) public int resolveSqlTypeLength(String columnTypeName, int jdbcTypeCode, int precision, int scale, int displaySize) Description copied from class:DialectNormalize JDBC result-set metadata to Hibernate's resolved column length.
JDBC
precisionmay represent character length. Providers should retain their vendor formulas using all supplied metadata values.- Overrides:
resolveSqlTypeLengthin classDialect
-
getPreferredSqlTypeCodeForBoolean
Description copied from class:DialectSelect the default
SqlTypescode for Javabooleanmappings.Return a Boolean-compatible code such as
SqlTypes.BOOLEAN,SqlTypes.BIT,SqlTypes.SMALLINT,SqlTypes.TINYINT, orSqlTypes.INTEGER. Thehibernate.type.preferred_boolean_jdbc_typesetting 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:
getPreferredSqlTypeCodeForBooleanin classDialect- Returns:
- a Boolean-compatible type code defined by
SqlTypes - See Also:
-
getPreferredSqlTypeCodeForArray
Description copied from class:DialectSelect the default
SqlTypescode 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, andSqlTypes.VARBINARY. Thehibernate.type.preferred_array_jdbc_typesetting 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:
getPreferredSqlTypeCodeForArrayin classDialect- Returns:
- a container type code defined by
SqlTypes - See Also:
-
initializeFunctionRegistry
@SPI({IMPLEMENT,SUPPLY}) public void initializeFunctionRegistry(FunctionContributions functionContributions) Description copied from class:DialectContribute the database-specific function descriptors after independent function contributors have run.
Override this callback to extend or replace the inherited function set. Invoke
superfirst 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 independentFunctionContributorinstead when the contribution is not owned by a Dialect.- Overrides:
initializeFunctionRegistryin classDialect- Parameters:
functionContributions- the Hibernate-supplied function contribution target- See Also:
-
registerJsonFunctions
-
getMaximumSeriesSize
protected int getMaximumSeriesSize()MySQL doesn't support thegenerate_seriesfunction orlateralrecursive CTEs, so it has to be emulated with a top level recursive CTE which requires an upper bound on the amount of elements that the series can return. -
contributeTypes
@SPI({IMPLEMENT,SUPPLY}) public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry) Description copied from class:DialectContribute 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
superfirst unless the Dialect intentionally replaces the complete inherited contribution protocol. Obtain reusable dialect-specific JDBC descriptors from the family facades inorg.hibernate.dialect.type.spi, and preserve whether a descriptor replaces an existing registration or is added only when absent.- Overrides:
contributeTypesin classDialect- Parameters:
typeContributions- the Hibernate-supplied contribution registryserviceRegistry-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
TypeContributorinstead when the contribution is not owned by a Dialect.
-
getSqlAstTranslatorFactory
Description copied from class:DialectSupply the factory for this Dialect's single-use SQL AST translators.
Return
nullto useStandardSqlAstTranslatorFactory. A custom Dialect should normally return a reusable factory derived from that class and create translators derived fromAbstractSqlAstTranslatoror an appropriate supported family base. The factory must not retain translation requests, and every translator it returns is used for one translation.- Overrides:
getSqlAstTranslatorFactoryin classDialect- See Also:
-
castPattern
Description copied from class:DialectObtain a pattern for the SQL equivalent to acast()function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.- Overrides:
castPatternin classDialect- Parameters:
from- aCastTypeindicating the type of the value argumentto- aCastTypeindicating the type the value argument is cast to
-
currentTimestamp
MySQL 5.7 precision defaults to seconds, but microseconds is better- Specified by:
currentTimestampin interfaceCurrentTemporalSupport
-
fractionalSecondPrecisionInNanos
microsecondis the smallest unit fortimestampadd()andtimestampdiff(), and the highest precision for atimestamp.- Specified by:
fractionalSecondPrecisionInNanosin interfaceTemporalOperationSupport
-
extractPattern
MySQL supports a limited list of temporal fields in the extract() function, but we can emulate some of them by using the appropriate named functions instead of extract().Thus, the additional supported fields are
TemporalUnit.DAY_OF_YEAR,TemporalUnit.DAY_OF_MONTH,TemporalUnit.DAY_OF_YEAR.In addition, the field
TemporalUnit.SECONDis redefined to include microseconds.- Specified by:
extractPatternin interfaceTemporalOperationSupport
-
timestampaddPattern
@SPI({USE,IMPLEMENT}) public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType) Description copied from interface:TemporalOperationSupportReturn a timestamp-add pattern containing?1,?2, and?3.- Specified by:
timestampaddPatternin interfaceTemporalOperationSupport
-
timestampdiffPattern
@SPI({USE,IMPLEMENT}) public String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType) Description copied from interface:TemporalOperationSupportReturn a timestamp-difference pattern containing?1,?2, and?3.- Specified by:
timestampdiffPatternin interfaceTemporalOperationSupport
-
getTemporalValueSemantics
Description copied from class:DialectSupply temporal precision-adjustment and literal-offset semantics. Return one stable, non-null immutable profile.- Overrides:
getTemporalValueSemanticsin classDialect- See Also:
-
appendDateTimeLiteral
@SPI({USE,IMPLEMENT}) public void appendDateTimeLiteral(SqlAppender appender, TemporalAccessor temporalAccessor, TemporalType precision, TimeZone jdbcTimeZone) Description copied from class:DialectAppend a datetime literal for a
java.timevalue.Preserve the value's offset only when the Dialect's temporal-value semantics permit it. Append immediately and retain no invocation state.
- Specified by:
appendDateTimeLiteralin interfaceLiteralSupport- Overrides:
appendDateTimeLiteralin classDialect
-
appendDateTimeLiteral
@SPI({USE,IMPLEMENT}) public void appendDateTimeLiteral(SqlAppender appender, Date date, TemporalType precision, TimeZone jdbcTimeZone) Description copied from class:DialectAppend a datetime literal for a legacy
Datevalue.Apply the supplied JDBC time zone where required, append immediately, and retain no invocation state.
- Specified by:
appendDateTimeLiteralin interfaceLiteralSupport- Overrides:
appendDateTimeLiteralin classDialect
-
appendDateTimeLiteral
@SPI({USE,IMPLEMENT}) public void appendDateTimeLiteral(SqlAppender appender, Calendar calendar, TemporalType precision, TimeZone jdbcTimeZone) Description copied from class:DialectAppend a datetime literal for a
Calendarvalue.Preserve Calendar-specific time-zone and millisecond semantics, append immediately, and retain no invocation state.
- Specified by:
appendDateTimeLiteralin interfaceLiteralSupport- Overrides:
appendDateTimeLiteralin classDialect
-
supports
- Specified by:
supportsin interfaceCheckConstraintSupport
-
getEnumSupport
Description copied from class:DialectSupply the database's finite-domain declaration, lifecycle, and check strategy. Return one stable, thread-safe strategy for this Dialect.- Overrides:
getEnumSupportin classDialect- Returns:
- the non-null enum support strategy
- See Also:
-
getQueryHintString
Description copied from class:DialectApply a hint to the given SQL query.The entire query is provided, allowing full control over the placement and syntax of the hint.
By default, ignore the hint and simply return the query.
- Overrides:
getQueryHintStringin classDialect- Parameters:
query- The query to which to apply the hint.hints- The hints to apply- Returns:
- The modified SQL
-
getSequenceSupport
No support for sequences.- Overrides:
getSequenceSupportin classDialect- Returns:
- the non-null sequence-support strategy
- See Also:
-
getViolatedConstraintNameExtractor
@SPI({IMPLEMENT,SUPPLY}) public ViolatedConstraintNameExtractor getViolatedConstraintNameExtractor()Description copied from class:DialectSupplies the extractor used to recover violated constraint names from database exceptions.
The extractor returns
nullwhen a name cannot be recovered. Do not use an empty string or sentinel to represent absence.- Specified by:
getViolatedConstraintNameExtractorin interfaceConversionContext- Overrides:
getViolatedConstraintNameExtractorin classDialect- Returns:
- the non-null constraint-name extractor
- See Also:
-
nameQualification
- Specified by:
nameQualificationin interfaceIndexDdlSupport
-
renderAddConstraint
- Specified by:
renderAddConstraintin interfaceForeignKeySupport
-
renderDropConstraint
- Specified by:
renderDropConstraintin interfaceForeignKeySupport
-
getUniqueDelegate
Description copied from class:DialectSupply the stable strategy used for unique-key representation and DDL.
Return a stock profile from
UniqueDelegates, or a stable provider-owned implementation or decorator. Do not import a Hibernate.internalleaf.- Overrides:
getUniqueDelegatein classDialect- See Also:
-
alterColumnType
- Specified by:
alterColumnTypein interfaceAlterTableSupport
-
getLimitHandler
Description copied from class:DialectSupplies execution-time pagination for already-rendered SQL requested by
Query.setMaxResults(int)orQuery.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 stockLimitHandleror extend a supported handler family. The returned handler may be reused concurrently and must not retain per-query state.- Overrides:
getLimitHandlerin classDialect- Returns:
- a non-null handler
-
closeQuote
Description copied from interface:IdentifierSupportReturn the character which closes a quoted identifier.- Specified by:
closeQuotein interfaceIdentifierSupport
-
openQuote
Description copied from interface:IdentifierSupportReturn the character which opens a quoted identifier.- Specified by:
openQuotein interfaceIdentifierSupport
-
getNamespaceSupport
Treat MySQL databases as catalogs for namespace lifecycle operations.
Although MySQL accepts
create schemaas a synonym forcreate database, Hibernate follows the JDBC driver's catalog model becauseDatabaseMetaData.supportsSchemasInDataManipulation()returns false.- Overrides:
getNamespaceSupportin classDialect- See Also:
-
getIfExistsSupport
Description copied from class:DialectSupply existence-check placement for schema DDL targets.
Return one immutable profile for this Dialect's lifetime.
- Overrides:
getIfExistsSupportin classDialect- See Also:
-
addPartitionKeyToPrimaryKey
Description copied from class:DialectWhether every table partition key must also occur in its primary key.
Return
trueonly when the database requires the rule for both ordinary and temporal-history tables. This has nothing to do with window-function partitioning.- Overrides:
addPartitionKeyToPrimaryKeyin classDialect
-
getSchemaCommentSupport
Description copied from class:DialectSupply schema-export support for comments attached to database objects.
This strategy does not control query comments, hints, SQL AST decoration, or statement inspection. Return one stable, non-null strategy.
- Overrides:
getSchemaCommentSupportin classDialect- See Also:
-
getNullOrderingSupport
Description copied from class:DialectSupply 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 rendernulls firstandnulls lastnatively. Dialect subclasses refining a family profile should copyDialect.getNullOrderingSupport()from the superclass and change only the values which differ.- Overrides:
getNullOrderingSupportin classDialect- Returns:
- the stable, non-null null-ordering-support profile
-
getMultiTableMutationSupport
Description copied from class:DialectSelect 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
CTErequires 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_STRATEGYorQuerySettings.QUERY_MULTI_TABLE_INSERT_STRATEGYinstead of depending on Hibernate's internal fallback implementations.- Overrides:
getMultiTableMutationSupportin classDialect- Returns:
- a stable, non-null fallback selection profile
-
getLocalTemporaryTableStrategy
Description copied from class:DialectSupplies this Dialect's local temporary-table strategy.
Return
nullwhen the database has no supported local temporary-table form. A non-null strategy must be stable for the Dialect lifetime and consistent withDialect.getTemporaryTableExporter().- Overrides:
getLocalTemporaryTableStrategyin classDialect
-
getMaxAliasLength
Description copied from interface:IdentifierSupportReturn the safe maximum length of a generated SQL alias, including room for Hibernate's generated suffix.- Specified by:
getMaxAliasLengthin interfaceIdentifierSupport
-
getMaxIdentifierLength
Description copied from interface:IdentifierSupportReturn the database's maximum identifier length.- Specified by:
getMaxIdentifierLengthin interfaceIdentifierSupport
-
getPredicateSupport
Description copied from class:DialectThe database's native predicate syntax and predicate-placement profile.
Override this method to supply independent support for a native case-insensitive-
likeoperator, scalardistinct from, truthness predicates, and predicates used as value expressions. An absent case-insensitive-likeoperator 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:
getPredicateSupportin classDialect- Returns:
- this Dialect's stable predicate-support profile
-
getCurrentTimestampSelection
Description copied from interface:CurrentTemporalSupportSelect the JDBC command used for database-side current timestamp retrieval, or returnnullwhen the database offers no supported command.- Specified by:
getCurrentTimestampSelectionin interfaceCurrentTemporalSupport- See Also:
-
causesRollback
Description copied from class:DialectDetermine 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
PessimisticLockExceptionorLockTimeoutException.- Overrides:
causesRollbackin classDialect- Parameters:
sqlException- the original database exception- Returns:
truewhen the failed statement invalidates the transaction
-
buildSQLExceptionConversionDelegate
@SPI({IMPLEMENT,SUPPLY}) public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()Description copied from class:DialectSupplies 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
nullresult means that it declined the exception so conversion may continue. Returnnullfrom this method when the Dialect has no vendor-specific delegate.Prefer stable vendor error codes or SQL states and preserve the original
SQLException.- Overrides:
buildSQLExceptionConversionDelegatein classDialect- Returns:
- the vendor conversion delegate, or
nullwhen none is supplied - See Also:
-
getNameQualifierSupport
Description copied from class:DialectSupply catalog and schema qualification support, or return
nullto useDatabaseMetaData.This value does not define the catalog separator; override
Dialect.getCatalogSeparator()independently when the metadata-free fallback is not..- Overrides:
getNameQualifierSupportin classDialect- See Also:
-
buildIdentifierHelper
@SPI({USE,IMPLEMENT,SUPPLY}) public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuildRequest request) Description copied from interface:IdentifierSupportBuild and supply the configured identifier helper from the stable JDBC metadata snapshot and selected keyword strategy.
This inherited implementation initializes identifier casing, keywords, and namespace support from the request. Invoke it before replacing any of those values with authoritative provider settings, then build the final helper from the same builder. Settings which this implementation does not initialize may be applied before invoking it. If builder configuration cannot express a database rule, decorate the final helper with
DelegatingIdentifierHelper. Do not retain the request, builder, or metadata view.- Specified by:
buildIdentifierHelperin interfaceIdentifierSupport- See Also:
-
getIdentityColumnSupport
Description copied from class:DialectSupply the stable identity-column DDL, insert syntax, and identity-specific retrieval behavior for this Dialect.
Override this method to supply a provider implementation of
IdentityColumnSupport. Prefer extendingIdentityColumnSupportBaseand return the same immutable or otherwise stable support instance on every invocation. Do not construct Hibernate mutation delegates in this supply point.- Overrides:
getIdentityColumnSupportin classDialect
-
isJdbcLogWarningsEnabledByDefault
-
supportsOnDeleteAction
- Specified by:
supportsOnDeleteActionin interfaceForeignKeySupport
-
tableCreationOptions
- Specified by:
tableCreationOptionsin interfaceTableCreationSupport
-
requiresSelfReferentialForeignKeyNullification
- Specified by:
requiresSelfReferentialForeignKeyNullificationin interfaceForeignKeySupport
-
getSchemaDropSupport
Description copied from class:DialectSupply schema-drop composition and ordered pre-drop commands.
Return one immutable profile for this Dialect's lifetime.
- Overrides:
getSchemaDropSupportin classDialect- See Also:
-
getDefaultMySQLStorageEngine
Select the storage engine used when none is explicitly configured.- Since:
- 8.0
-
appendLiteral
Description copied from interface:LiteralSupportAppend a SQL string literal.- Specified by:
appendLiteralin interfaceLiteralSupport
-
appendFormat
Description copied from interface:TemporalFormatSupportAppend the database translation of the supplied Hibernate format pattern.- Specified by:
appendFormatin interfaceTemporalFormatSupport
-
datetimeFormat
-
getLockingSupport
Description copied from class:DialectSupplies 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:
getLockingSupportin classDialect- See Also:
-
getSubquerySupport
Description copied from class:DialectSupplies 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
existspredicates in the select list are separate capabilities. Lateral spelling and fallback rendering remain translator responsibilities. When refining a family Dialect, start fromSubquerySupport.builder(super.getSubquerySupport())and change only the differing placements.- Overrides:
getSubquerySupportin classDialect- Returns:
- this Dialect's stable subquery-support profile
-
getWindowFunctionSupport
Description copied from class:DialectSupplies the native window-function syntax supported by this database.
Return one non-null, immutable profile whose values remain stable for this Dialect's lifetime. Baseline window calls, window partitioning, each frame unit, and frame exclusion are independent grammar facts. Every refinement requires baseline window support, and frame exclusion additionally requires a supported frame unit. Function-specific restrictions and individual frame-bound restrictions remain the responsibility of focused rendering.
When refining a family Dialect, start from
WindowFunctionSupport.builder(super.getWindowFunctionSupport())and change only the differing features.- Overrides:
getWindowFunctionSupportin classDialect- Returns:
- this Dialect's stable window-function-support profile
-
getCteSupport
Description copied from class:DialectThe common-table-expression capabilities of this Dialect.
The returned immutable profile must be non-null and stable for the lifetime of this Dialect. Hibernate may cache and reuse it. Overrides may construct a new profile or copy
CteSupport.STANDARD; invokingsuperis not required. This method is called only after Dialect construction, has no corresponding shutdown lifecycle, and failures propagate to the operation which obtains the profile.- Overrides:
getCteSupportin classDialect
-
getSetOperationSupport
Description copied from class:DialectSupplies 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
SetOperatorindependently; support for a distinct operator never implies itsALLform. Structural capabilities such asUNIONplacement in subqueries are separate from operator support. Continue to overrideDialect.getSetOperatorSqlString(SetOperator)when an operator requires database-specific spelling. When refining a family Dialect, start fromSetOperationSupport.builder(super.getSetOperationSupport())and change only the differing values.- Overrides:
getSetOperationSupportin classDialect- Returns:
- this Dialect's stable set-operation profile
-
contributeKeywords
Description copied from class:DialectContribute ANSI and database-specific SQL keywords.
Invoke
superfirst to retain the SQL:2003 words. Omittingsuperdeliberately replaces the inherited keyword profile. Register words only during this callback and do not retain the registration target.- Overrides:
contributeKeywordsin classDialect- Parameters:
registration- the scoped keyword target
-
supportsAliasLocks
protected boolean supportsAliasLocks() -
getFunctionalDependencyAnalysisSupport
@SPI({IMPLEMENT,SUPPLY}) public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport()Description copied from class:DialectThe database's support for recognizing primary-key functional dependency in
group byandorder byclauses.This profile controls when Hibernate may omit functionally dependent columns. Report only behavior guaranteed by the database across the Dialect's supported versions.
- Overrides:
getFunctionalDependencyAnalysisSupportin classDialect- Returns:
- a non-null immutable capability profile
- See Also:
-
constraintControlMode
- Specified by:
constraintControlModein interfaceConstraintControlSupport- Overrides:
constraintControlModein classDialect
-
disableCommands
- Specified by:
disableCommandsin interfaceConstraintControlSupport
-
enableCommands
- Specified by:
enableCommandsin interfaceConstraintControlSupport
-
getDmlTargetColumnQualifierSupport
@SPI({USE,IMPLEMENT,SUPPLY}) public DmlTargetColumnQualifierSupport getDmlTargetColumnQualifierSupport()Description copied from class:DialectThe qualifier form accepted for target-column references in update and delete statements.
Translators use this value when rendering assignments and predicates. A custom Dialect should return the least permissive form required by the database, not a form used only by an emulation.
- Overrides:
getDmlTargetColumnQualifierSupportin classDialect- Returns:
- the non-null target-column qualifier support
- See Also:
-
getMutationSyntaxSupport
Description copied from class:DialectThe 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.
QueryMutationRenderingSupportconsumes this profile when selecting a native or emulated plan.- Overrides:
getMutationSyntaxSupportin classDialect
-
render
- Specified by:
renderin interfaceCheckConstraintSupport
-
getObjectNullBindingStrategy
Description copied from class:DialectSupply the JDBC strategy for binding an untyped Javanull.- Overrides:
getObjectNullBindingStrategyin classDialect- Returns:
- the non-null binding strategy
- See Also:
-
getSingleRowTableSupport
Description copied from class:DialectSupply 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-onlyfromfragment are independent; an empty fragment means that nofromclause is required. Dialect subclasses refining a family profile should copyDialect.getSingleRowTableSupport()from the superclass and change only the values which differ.- Overrides:
getSingleRowTableSupportin classDialect- Returns:
- the stable, non-null single-row-table-support profile
-
getRowValueSupport
Description copied from class:DialectThe native row-value syntax of this Dialect.
Override this method to supply explicit
row(a, b)construction, row equality, ordering, and distinctness comparisons, row-valuedINlists, row-valuedINsubqueries, and quantified row comparisons. Treat each feature as an exact native-syntax declaration: do not inferIN-subquery support fromIN-list support or explicit row construction from comparison support. Copy the superclass profile when refining an inherited Dialect family. Return one immutable, non-null profile whose values remain stable for the lifetime of this Dialect.- Overrides:
getRowValueSupportin classDialect- Returns:
- this Dialect's stable row-value-support profile
-
createOptionalTableUpdateOperation
@SPI({USE,IMPLEMENT,SUPPLY}) public MutationOperation createOptionalTableUpdateOperation(OptionalTableUpdateOperationRequest request) Description copied from class:DialectCreates the JDBC mutation operation for an optional-table update.
Override this factory when the database needs an operation other than the standard update-then-insert behavior. The request contains the semantic update and bootstrap services; implementations must return an operation for the same
OptionalTableUpdateOperationRequest.mutationTarget()and must not retain the request.- Overrides:
createOptionalTableUpdateOperationin classDialect- Returns:
- a non-null operation for the supplied optional-table update
- See Also:
-
getInformationExtractor
@SPI({IMPLEMENT,SUPPLY}) public InformationExtractor getInformationExtractor(ExtractionContext extractionContext) Description copied from class:DialectSupply the context-bound strategy Hibernate uses to discover database tables, keys, indexes, and related schema metadata.
Return a new extractor for
extractionContext. Prefer a stock profile fromInformationExtractors, and implementInformationExtractordirectly only when none of those complete profiles matches the database.- Overrides:
getInformationExtractorin classDialect- See Also:
-
getTemporalTableSupport
Description copied from class:DialectSupplies the complete temporal-table DDL and historical-query strategy for this Dialect.
Return an immutable strategy and use the supported request values without retaining them. Prefer
TemporalTableSupports.standard(int, int, boolean)when only the column type, precision, and table-check capability differ.- Overrides:
getTemporalTableSupportin classDialect- Returns:
- the non-null temporal-table support strategy
- See Also:
-