Top Description Fields Constructors Methods
org.hibernate.dialect

public Class MariaDBDialect

extends MySQLDialect
Class Inheritance
Known Direct Subclasses
org.hibernate.dialect.MariaDB106Dialect
Imports
java.sql.DatabaseMetaData, .SQLException, org.hibernate.boot.model.FunctionContributions, .TypeContributions, org.hibernate.dialect.function.CommonFunctionFactory, org.hibernate.dialect.sequence.MariaDBSequenceSupport, .SequenceSupport, org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo, org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy, .IdentifierHelper, .IdentifierHelperBuilder, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.service.ServiceRegistry, org.hibernate.sql.ast.SqlAstTranslator, .SqlAstTranslatorFactory, org.hibernate.sql.ast.spi.StandardSqlAstTranslatorFactory, org.hibernate.sql.ast.tree.Statement, org.hibernate.sql.exec.spi.JdbcOperation, org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorMariaDBDatabaseImpl, org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor, org.hibernate.type.SqlTypes, .StandardBasicTypes, org.hibernate.type.descriptor.jdbc.JdbcType, .JsonJdbcType, org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry, org.hibernate.type.descriptor.sql.internal.DdlTypeImpl, org.hibernate.type.descriptor.sql.spi.DdlTypeRegistry

A SQL dialect for MariaDB 10.3 and above.
Authors
Vlad Mihalcea, Gavin King

Field Summary

Modifier and TypeField and Description
private static final DatabaseVersion
private static final DatabaseVersion

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
public IdentifierHelper
buildIdentifierHelper(IdentifierHelperBuilder
A partially-configured IdentifierHelperBuilder.
builder
,
DatabaseMetaData
Access to the metadata returned from the driver if needed and if available

Warning

it may be null.

dbMetaData
)

Overrides org.hibernate.dialect.MySQLDialect.buildIdentifierHelper.

The IdentifierHelper indicated by this dialect for handling identifier conversions.
public void
contributeTypes(TypeContributions
Callback to contribute the types
typeContributions
,
ServiceRegistry
The service registry
serviceRegistry
)

Overrides org.hibernate.dialect.MySQLDialect.contributeTypes.

A callback which allows the Dialect to contribute types.
protected MySQLStorageEngine
public FunctionalDependencyAnalysisSupport
getFunctionalDependencyAnalysisSupport()

Overrides org.hibernate.dialect.MySQLDialect.getFunctionalDependencyAnalysisSupport.

Get this dialect's level of support for primary key functional dependency analysis within GROUP BY and ORDER BY clauses.
protected DatabaseVersion
getMinimumSupportedVersion()

Overrides org.hibernate.dialect.MySQLDialect.getMinimumSupportedVersion.

Get the version of the SQL dialect that is the minimum supported by this implementation.
public DatabaseVersion
public NationalizationSupport
getNationalizationSupport()

Overrides org.hibernate.dialect.Dialect.getNationalizationSupport.

Determines whether this database requires the use of explicitly nationalized character (Unicode) data types.
public String
getQuerySequencesString()

Overrides org.hibernate.dialect.Dialect.getQuerySequencesString.

Get the select command used retrieve the names of all sequences.
public SequenceInformationExtractor
public SequenceSupport
public SqlAstTranslatorFactory
public void
initializeFunctionRegistry(FunctionContributions functionContributions)

Overrides org.hibernate.dialect.MySQLDialect.initializeFunctionRegistry.

Initialize the given registry with any dialect-specific functions.
protected void
registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)

Overrides org.hibernate.dialect.MySQLDialect.registerColumnTypes.

Register ANSI-standard column types using the length limits defined by getMaxVarcharLength(), getMaxNVarcharLength(), and getMaxVarbinaryLength().
public JdbcType
resolveSqlTypeDescriptor(String
the column type name
columnTypeName
,
int jdbcTypeCode, int
the precision or 0
precision
,
int
the scale or 0
scale
,
JdbcTypeRegistry jdbcTypeRegistry)

Overrides org.hibernate.dialect.MySQLDialect.resolveSqlTypeDescriptor.

Assigns an appropriate JdbcType to a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.
pack-priv boolean
public boolean
supportsColumnCheck()

Overrides org.hibernate.dialect.MySQLDialect.supportsColumnCheck.

Does this dialect support column-level check constraints?
pack-priv boolean
public boolean
supportsIfExistsAfterAlterTable()

Overrides org.hibernate.dialect.Dialect.supportsIfExistsAfterAlterTable.

For an alter table, can the phrase if exists be applied?
public boolean
supportsIfExistsBeforeConstraintName()

Overrides org.hibernate.dialect.Dialect.supportsIfExistsBeforeConstraintName.

For dropping a constraint with an alter table statement, can the phrase if exists be applied before the constraint name?
public boolean

Returns:

true for 10.5 and above because Maria supports insert ... returning even though MySQL does not
supportsInsertReturning
()

Overrides org.hibernate.dialect.Dialect.supportsInsertReturning.

Does this dialect fully support returning arbitrary generated column values after execution of an insert statement, using native SQL syntax?
public boolean
supportsLateral()

Overrides org.hibernate.dialect.MySQLDialect.supportsLateral.

Does this dialect support the SQL lateral keyword or a proprietary alternative?
public boolean
supportsNoWait()

Overrides org.hibernate.dialect.MySQLDialect.supportsNoWait.

Does this dialect support NO_WAIT timeout.
public boolean
supportsRecursiveCTE()

Overrides org.hibernate.dialect.MySQLDialect.supportsRecursiveCTE.

Does this dialect/database support recursive CTEs?
public boolean
supportsSkipLocked()

Overrides org.hibernate.dialect.MySQLDialect.supportsSkipLocked.

Does this dialect support SKIP_LOCKED timeout.
public boolean
supportsWait()

Overrides org.hibernate.dialect.MySQLDialect.supportsWait.

Does this dialect support WAIT timeout.
public boolean
supportsWindowFunctions()

Overrides org.hibernate.dialect.MySQLDialect.supportsWindowFunctions.

Does this dialect support window functions like row_number() over (..)?
Inherited from org.hibernate.dialect.MySQLDialect:
appendDatetimeFormatappendDateTimeLiteralappendDateTimeLiteralappendDateTimeLiteralappendLiteralbuildSQLExceptionConversionDelegatecanCreateCatalogcanCreateSchemacanDisableConstraintscastPatterncastTypecloseQuotecolumnTypecreateVersioncurrentTimestampdatetimeFormatdropConstraintsextractPatterngetAddForeignKeyConstraintStringgetAlterColumnTypeStringgetCharacterSetBytesPerCharactergetColumnCommentgetCreateCatalogCommandgetCreateSchemaCommandgetCurrentTimestampSelectStringgetDefaultLobLengthgetDisableConstraintsStatementgetDropCatalogCommandgetDropForeignKeyStringgetDropSchemaCommandgetDropUniqueKeyStringgetEnableConstraintsStatementgetEnumTypeDeclarationgetFallbackSqmInsertStrategygetFallbackSqmMutationStrategygetFloatPrecisiongetForUpdateNowaitStringgetForUpdateNowaitStringgetForUpdateSkipLockedStringgetForUpdateSkipLockedStringgetForUpdateStringgetFractionalSecondPrecisionInNanosgetGroupBySelectItemReferenceStrategygetIdentityColumnSupportgetLimitHandlergetMaxAliasLengthgetMaxIdentifierLengthgetMaxVarbinaryLengthgetMaxVarcharLengthgetNameQualifierSupportgetNullColumnStringgetNullOrderinggetPreferredSqlTypeCodeForBooleangetQueryHintStringgetReadLockStringgetReadLockStringgetResultSetgetSelectGUIDStringgetSizeStrategygetSupportedTemporaryTableKindgetTableCommentgetTableTypeStringgetTemporaryTableAfterUseActiongetTemporaryTableBeforeUseActiongetTemporaryTableCreateCommandgetTemporaryTableDropCommandgetViolatedConstraintNameExtractorgetWriteLockStringgetWriteLockStringgetWriteRowLockStrategyhasSelfReferentialForeignKeyBuginitDefaultPropertiesisCurrentTimestampSelectStringCallableisJdbcLogWarningsEnabledByDefaultisNoBackslashEscapesEnabledopenQuotequalifyIndexNameregisterDefaultKeywordsregisterResultSetOutParametersupportsAlterColumnTypesupportsCascadeDeletesupportsCommentOnsupportsCurrentTimestampSelectionsupportsIfExistsBeforeTableNamesupportsIsTruesupportsLobValueChangePropagationsupportsLockTimeoutssupportsNullPrecedencesupportsOffsetInSubquerysupportsSubqueryOnMutatingTablesupportsTemporalLiteralOffsettimestampaddPatterntimestampdiffPatternuseMaterializedLobWhenCapacityExceeded

Field Detail

MINIMUM_VERSIONback to summary
private static final DatabaseVersion MINIMUM_VERSION

Hides org.hibernate.dialect.MySQLDialect.MINIMUM_VERSION.

MYSQL57back to summary
private static final DatabaseVersion MYSQL57

Constructor Detail

MariaDBDialectback to summary
public MariaDBDialect()
MariaDBDialectback to summary
public MariaDBDialect(DatabaseVersion version)
MariaDBDialectback to summary
public MariaDBDialect(DialectResolutionInfo info)

Method Detail

buildIdentifierHelperback to summary
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException

Overrides org.hibernate.dialect.MySQLDialect.buildIdentifierHelper.

Doc from org.hibernate.dialect.Dialect.buildIdentifierHelper.

The IdentifierHelper indicated by this dialect for handling identifier conversions. Returning null is allowed and indicates that Hibernate should fall back to building a "standard" helper. In the fallback path, any changes made to the IdentifierHelperBuilder during this call will still be incorporated into the built IdentifierHelper.

The incoming builder will have the following set:

By default, Hibernate will do the following:

Parameters
builder:IdentifierHelperBuilder

A partially-configured IdentifierHelperBuilder.

dbMetaData:DatabaseMetaData

Access to the metadata returned from the driver if needed and if available

Warning

it may be null.

Returns:IdentifierHelper

The IdentifierHelper instance to use, or null to indicate Hibernate should use its fallback path

Annotations
@Override
Exceptions
SQLException:
Accessing the DatabaseMetaData can throw it. Just rethrow and Hibernate will handle it.
contributeTypesback to summary
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)

Overrides org.hibernate.dialect.MySQLDialect.contributeTypes.

Doc from org.hibernate.dialect.Dialect.contributeTypes.

A callback which allows the Dialect to contribute types.

Parameters
typeContributions:TypeContributions

Callback to contribute the types

serviceRegistry:ServiceRegistry

The service registry

Annotations
@Override
getDefaultMySQLStorageEngineback to summary
protected MySQLStorageEngine getDefaultMySQLStorageEngine()

Overrides org.hibernate.dialect.MySQLDialect.getDefaultMySQLStorageEngine.

Annotations
@Override
getFunctionalDependencyAnalysisSupportback to summary
public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport()

Overrides org.hibernate.dialect.MySQLDialect.getFunctionalDependencyAnalysisSupport.

Doc from org.hibernate.dialect.Dialect.getFunctionalDependencyAnalysisSupport.

Get this dialect's level of support for primary key functional dependency analysis within GROUP BY and ORDER BY clauses.

Annotations
@Override
getMinimumSupportedVersionback to summary
protected DatabaseVersion getMinimumSupportedVersion()

Overrides org.hibernate.dialect.MySQLDialect.getMinimumSupportedVersion.

Doc from org.hibernate.dialect.Dialect.getMinimumSupportedVersion.

Get the version of the SQL dialect that is the minimum supported by this implementation.

Annotations
@Override
getMySQLVersionback to summary
public DatabaseVersion getMySQLVersion()

Overrides org.hibernate.dialect.MySQLDialect.getMySQLVersion.

Annotations
@Override
getNationalizationSupportback to summary
public NationalizationSupport getNationalizationSupport()

Overrides org.hibernate.dialect.Dialect.getNationalizationSupport.

Doc from org.hibernate.dialect.Dialect.getNationalizationSupport.

Determines whether this database requires the use of explicitly nationalized character (Unicode) data types.

That is, whether the use of Types#NCHAR, Types#NVARCHAR, and Types#NCLOB is required for nationalized character data.

Annotations
@Override
getQuerySequencesStringback to summary
public String getQuerySequencesString()

Overrides org.hibernate.dialect.Dialect.getQuerySequencesString.

Doc from org.hibernate.dialect.Dialect.getQuerySequencesString.

Get the select command used retrieve the names of all sequences.

Returns:String

The select command; or null if sequences are not supported.

Annotations
@Override
getSequenceInformationExtractorback to summary
public SequenceInformationExtractor getSequenceInformationExtractor()

Overrides org.hibernate.dialect.Dialect.getSequenceInformationExtractor.

Doc from org.hibernate.dialect.Dialect.getSequenceInformationExtractor.

A SequenceInformationExtractor which is able to extract org.hibernate.tool.schema.extract.spi.SequenceInformation from the JDBC result set returned when getQuerySequencesString() is executed.

Annotations
@Override
getSequenceSupportback to summary
public SequenceSupport getSequenceSupport()

Overrides org.hibernate.dialect.MySQLDialect.getSequenceSupport.

Doc from org.hibernate.dialect.MySQLDialect.getSequenceSupport.

No support for sequences.

Annotations
@Override
getSqlAstTranslatorFactoryback to summary
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()

Overrides org.hibernate.dialect.MySQLDialect.getSqlAstTranslatorFactory.

Doc from org.hibernate.dialect.Dialect.getSqlAstTranslatorFactory.

Return a SqlAstTranslatorFactory specific to this dialect, or null to use the standard translator.

Annotations
@Override
initializeFunctionRegistryback to summary
public void initializeFunctionRegistry(FunctionContributions functionContributions)

Overrides org.hibernate.dialect.MySQLDialect.initializeFunctionRegistry.

Doc from org.hibernate.dialect.Dialect.initializeFunctionRegistry.

Initialize the given registry with any dialect-specific functions.

Support for certain SQL functions is required, and if the database does not support a required function, then the dialect must define a way to emulate it.

These required functions include the functions defined by the JPA query language specification:

  • avg(arg) - aggregate function
  • count([distinct ]arg) - aggregate function
  • max(arg) - aggregate function
  • min(arg) - aggregate function
  • sum(arg) - aggregate function
  • coalesce(arg0, arg1, ...)
  • nullif(arg0, arg1)
  • lower(arg)
  • upper(arg)
  • length(arg)
  • concat(arg0, arg1, ...)
  • locate(pattern, string[, start])
  • substring(string, start[, length])
  • trim([[spec ][character ]from] string)
  • abs(arg)
  • mod(arg0, arg1)
  • sqrt(arg)
  • current date
  • current time
  • current timestamp
Along with an additional set of functions defined by ANSI SQL:
  • any(arg) - aggregate function
  • every(arg) - aggregate function
  • var_samp(arg) - aggregate function
  • var_pop(arg) - aggregate function
  • stddev_samp(arg) - aggregate function
  • stddev_pop(arg) - aggregate function
  • cast(arg as Type)
  • extract(field from arg)
  • ln(arg)
  • exp(arg)
  • power(arg0, arg1)
  • floor(arg)
  • ceiling(arg)
  • position(pattern in string)
  • substring(string from start[ for length])
  • overlay(string placing replacement from start[ for length])
And the following functions for working with java.time types:
  • local date
  • local time
  • local datetime
  • offset datetime
  • instant
And a number of additional "standard" functions:
  • left(string, length)
  • right(string, length)
  • replace(string, pattern, replacement)
  • pad(string with length spec[ character])
  • repeat(string, times)
  • pi
  • log10(arg)
  • log(base, arg)
  • sign(arg)
  • sin(arg)
  • cos(arg)
  • tan(arg)
  • asin(arg)
  • acos(arg)
  • atan(arg)
  • atan2(arg0, arg1)
  • round(arg0[, arg1])
  • truncate(arg0[, arg1])
  • sinh(arg)
  • tanh(arg)
  • cosh(arg)
  • least(arg0, arg1, ...)
  • greatest(arg0, arg1, ...)
  • degrees(arg)
  • radians(arg)
  • format(datetime as pattern)
  • collate(string as collation)
  • str(arg) - synonym of cast(a as String)
  • ifnull(arg0, arg1) - synonym of coalesce(a, b)
Finally, the following functions are defined as abbreviations for extract(), and desugared by the parser:
  • second(arg) - synonym of extract(second from a)
  • minute(arg) - synonym of extract(minute from a)
  • hour(arg) - synonym of extract(hour from a)
  • day(arg) - synonym of extract(day from a)
  • month(arg) - synonym of extract(month from a)
  • year(arg) - synonym of extract(year from a)
Note that according to this definition, the second() function returns a floating point value, contrary to the integer type returned by the native function with this name on many databases. Thus, we don't just naively map these HQL functions to the native SQL functions with the same names.
Annotations
@Override
registerColumnTypesback to summary
protected void registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)

Overrides org.hibernate.dialect.MySQLDialect.registerColumnTypes.

Doc from org.hibernate.dialect.Dialect.registerColumnTypes.

Register ANSI-standard column types using the length limits defined by getMaxVarcharLength(), getMaxNVarcharLength(), and getMaxVarbinaryLength().

This method is always called when a Dialect is instantiated.

Annotations
@Override
resolveSqlTypeDescriptorback to summary
public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)

Overrides org.hibernate.dialect.MySQLDialect.resolveSqlTypeDescriptor.

Doc from org.hibernate.dialect.Dialect.resolveSqlTypeDescriptor.

Assigns an appropriate JdbcType to a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.

Parameters
columnTypeName:String

the column type name

jdbcTypeCode:int

the type code

precision:int

the precision or 0

scale:int

the scale or 0

Returns:JdbcType

an appropriate instance of JdbcType

Annotations
@Override
supportsAliasLocksback to summary
pack-priv boolean supportsAliasLocks()

Overrides org.hibernate.dialect.MySQLDialect.supportsAliasLocks.

Annotations
@Override
supportsColumnCheckback to summary
public boolean supportsColumnCheck()

Overrides org.hibernate.dialect.MySQLDialect.supportsColumnCheck.

Doc from org.hibernate.dialect.Dialect.supportsColumnCheck.

Does this dialect support column-level check constraints?

Returns:boolean

True if column-level check constraints are supported; false otherwise.

Annotations
@Override
supportsForShareback to summary
pack-priv boolean supportsForShare()

Overrides org.hibernate.dialect.MySQLDialect.supportsForShare.

Annotations
@Override
supportsIfExistsAfterAlterTableback to summary
public boolean supportsIfExistsAfterAlterTable()

Overrides org.hibernate.dialect.Dialect.supportsIfExistsAfterAlterTable.

Doc from org.hibernate.dialect.Dialect.supportsIfExistsAfterAlterTable.

For an alter table, can the phrase if exists be applied?

Returns:boolean

true if if exists can be applied after alter table

Annotations
@Override
supportsIfExistsBeforeConstraintNameback to summary
public boolean supportsIfExistsBeforeConstraintName()

Overrides org.hibernate.dialect.Dialect.supportsIfExistsBeforeConstraintName.

Doc from org.hibernate.dialect.Dialect.supportsIfExistsBeforeConstraintName.

For dropping a constraint with an alter table statement, can the phrase if exists be applied before the constraint name?

Returns:boolean

true if if exists can be applied before the constraint name

Annotations
@Override
supportsInsertReturningback to summary
public boolean supportsInsertReturning()

Overrides org.hibernate.dialect.Dialect.supportsInsertReturning.

Doc from org.hibernate.dialect.Dialect.supportsInsertReturning.

Does this dialect fully support returning arbitrary generated column values after execution of an insert statement, using native SQL syntax?

Support for identity columns is insufficient here, we require something like:

  1. insert ... returning ...
  2. select from final table (insert ... )
Returns:boolean

true for 10.5 and above because Maria supports insert ... returning even though MySQL does not

Annotations
@Override
supportsLateralback to summary
public boolean supportsLateral()

Overrides org.hibernate.dialect.MySQLDialect.supportsLateral.

Doc from org.hibernate.dialect.Dialect.supportsLateral.

Does this dialect support the SQL lateral keyword or a proprietary alternative?

Returns:boolean

true if the underlying database supports lateral, false otherwise. The default is false.

Annotations
@Override
supportsNoWaitback to summary
public boolean supportsNoWait()

Overrides org.hibernate.dialect.MySQLDialect.supportsNoWait.

Doc from org.hibernate.dialect.Dialect.supportsNoWait.

Does this dialect support NO_WAIT timeout.

Returns:boolean

true if NO_WAIT is supported

Annotations
@Override
supportsRecursiveCTEback to summary
public boolean supportsRecursiveCTE()

Overrides org.hibernate.dialect.MySQLDialect.supportsRecursiveCTE.

Doc from org.hibernate.dialect.Dialect.supportsRecursiveCTE.

Does this dialect/database support recursive CTEs?

Returns:boolean

true if recursive CTEs are supported

Annotations
@Override
supportsSkipLockedback to summary
public boolean supportsSkipLocked()

Overrides org.hibernate.dialect.MySQLDialect.supportsSkipLocked.

Doc from org.hibernate.dialect.Dialect.supportsSkipLocked.

Does this dialect support SKIP_LOCKED timeout.

Returns:boolean

true if SKIP_LOCKED is supported

Annotations
@Override
supportsWaitback to summary
public boolean supportsWait()

Overrides org.hibernate.dialect.MySQLDialect.supportsWait.

Doc from org.hibernate.dialect.Dialect.supportsWait.

Does this dialect support WAIT timeout.

Returns:boolean

true if WAIT is supported

Annotations
@Override
supportsWindowFunctionsback to summary
public boolean supportsWindowFunctions()

Overrides org.hibernate.dialect.MySQLDialect.supportsWindowFunctions.

Doc from org.hibernate.dialect.Dialect.supportsWindowFunctions.

Does this dialect support window functions like row_number() over (..)?

Returns:boolean

true if the underlying database supports window functions, false otherwise. The default is false.

Annotations
@Override