Package org.hibernate.dialect
Class MariaDBDialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- org.hibernate.dialect.MySQLDialect
-
- org.hibernate.dialect.MariaDBDialect
-
- All Implemented Interfaces:
FunctionContributor
,TypeContributor
,ConversionContext
- Direct Known Subclasses:
MariaDB103Dialect
public class MariaDBDialect extends MySQLDialect
A SQL dialect for MariaDB 10.3 and above.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl
-
-
Field Summary
-
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description MariaDBDialect()
MariaDBDialect(DatabaseVersion version)
MariaDBDialect(DialectResolutionInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentifierHelper
buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
TheIdentifierHelper
indicated by this dialect for handling identifier conversions.void
contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
A callback which allows theDialect
to contribute types.protected MySQLStorageEngine
getDefaultMySQLStorageEngine()
FunctionalDependencyAnalysisSupport
getFunctionalDependencyAnalysisSupport()
Get this dialect's level of support for primary key functional dependency analysis withinGROUP BY
andORDER BY
clauses.protected DatabaseVersion
getMinimumSupportedVersion()
Get the version of the SQL dialect that is the minimum supported by this implementation.DatabaseVersion
getMySQLVersion()
NationalizationSupport
getNationalizationSupport()
Determines whether this database requires the use of explicitly nationalized character (Unicode) data types.String
getQuerySequencesString()
Get theselect
command used retrieve the names of all sequences.SequenceInformationExtractor
getSequenceInformationExtractor()
ASequenceInformationExtractor
which is able to extractSequenceInformation
from the JDBC result set returned whenDialect.getQuerySequencesString()
is executed.SequenceSupport
getSequenceSupport()
No support for sequences.SqlAstTranslatorFactory
getSqlAstTranslatorFactory()
void
initializeFunctionRegistry(FunctionContributions functionContributions)
Initialize the given registry with any dialect-specific functions.protected void
registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Register ANSI-standard column types using the length limits defined byDialect.getMaxVarcharLength()
,Dialect.getMaxNVarcharLength()
, andDialect.getMaxVarbinaryLength()
.JdbcType
resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
Assigns an appropriateJdbcType
to a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.boolean
supportsColumnCheck()
Does this dialect support column-level check constraints?boolean
supportsIfExistsAfterAlterTable()
For analter table
, can the phraseif exists
be applied?boolean
supportsIfExistsBeforeConstraintName()
For dropping a constraint with analter table
statement, can the phraseif exists
be applied before the constraint name?boolean
supportsInsertReturning()
Does this dialect fully support returning arbitrary generated column values after execution of aninsert
statement, using native SQL syntax?boolean
supportsLateral()
Does this dialect support the SQLlateral
keyword or a proprietary alternative?boolean
supportsNoWait()
Does this dialect supportNO_WAIT
timeout.boolean
supportsRecursiveCTE()
Does this dialect/database support recursive CTEs?boolean
supportsSkipLocked()
Does this dialect supportSKIP_LOCKED
timeout.boolean
supportsWait()
Does this dialect supportWAIT
timeout.boolean
supportsWindowFunctions()
Does this dialect support window functions likerow_number() over (..)
?-
Methods inherited from class org.hibernate.dialect.MySQLDialect
appendDatetimeFormat, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendLiteral, buildSQLExceptionConversionDelegate, canCreateCatalog, canCreateSchema, canDisableConstraints, castPattern, castType, closeQuote, columnType, createVersion, currentTimestamp, datetimeFormat, dropConstraints, extractPattern, getAddForeignKeyConstraintString, getAlterColumnTypeString, getCharacterSetBytesPerCharacter, getColumnComment, getCreateCatalogCommand, getCreateSchemaCommand, getCurrentTimestampSelectString, getDefaultLobLength, getDisableConstraintsStatement, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropUniqueKeyString, getEnableConstraintsStatement, getEnumTypeDeclaration, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getFloatPrecision, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getFractionalSecondPrecisionInNanos, getGroupBySelectItemReferenceStrategy, getIdentityColumnSupport, getLimitHandler, getMaxAliasLength, getMaxIdentifierLength, getMaxVarbinaryLength, getMaxVarcharLength, getNameQualifierSupport, getNullColumnString, getNullOrdering, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getReadLockString, getReadLockString, getResultSet, getSelectGUIDString, getSizeStrategy, getSupportedTemporaryTableKind, getTableComment, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableDropCommand, getViolatedConstraintNameExtractor, getWriteLockString, getWriteLockString, getWriteRowLockStrategy, hasSelfReferentialForeignKeyBug, initDefaultProperties, isCurrentTimestampSelectStringCallable, isJdbcLogWarningsEnabledByDefault, isNoBackslashEscapesEnabled, openQuote, qualifyIndexName, registerDefaultKeywords, registerResultSetOutParameter, supportsAlterColumnType, supportsCascadeDelete, supportsCommentOn, supportsCurrentTimestampSelection, supportsIfExistsBeforeTableName, supportsIsTrue, supportsLobValueChangePropagation, supportsLockTimeouts, supportsNullPrecedence, supportsOffsetInSubquery, supportsSubqueryOnMutatingTable, supportsTemporalLiteralOffset, timestampaddPattern, timestampdiffPattern, useMaterializedLobWhenCapacityExceeded
-
Methods inherited from class org.hibernate.dialect.Dialect
addSqlHintOrComment, appendArrayLiteral, appendBinaryLiteral, appendBooleanValueString, appendIntervalLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, canBatchTruncate, checkVersion, contribute, contributeFunctions, createOptionalTableUpdateOperation, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestampWithTimeZone, defaultScrollMode, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, equivalentTypes, escapeComment, forceLobAsLastValue, generatedAs, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAggregateSupport, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getColumnAliasExtractor, getCreateEnumTypeCommand, getCreateEnumTypeCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getCreateUserDefinedTypeKindString, getCurrentSchemaCommand, getDefaultDecimalPrecision, getDefaultNonContextualLobCreation, getDefaultProperties, getDefaultStatementBatchSize, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintStatement, getDmlTargetColumnQualifierSupport, getDoublePrecision, getDropEnumTypeCommand, getDropEnumTypeCommand, getDropTableString, getEnableConstraintStatement, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getForeignKeyExporter, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getHqlTranslator, getIndexExporter, getInExpressionCountLimit, getKeywords, getLobMergeStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarcharCapacity, getMultiKeyLoadSizingStrategy, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNoColumnsInsertString, getNullColumnString, getParameterCountLimit, getPreferredSqlTypeCodeForArray, getQueryHintString, getReadRowLockStrategy, getResultSet, getResultSet, getRowIdColumnString, getSchemaNameResolver, getSelectClauseNullString, getSequenceExporter, getSqmTranslatorFactory, getTableCleaner, getTableExporter, getTableMigrator, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTimeZoneSupport, getTruncateTableStatement, getTruncateTableStatements, getUniqueDelegate, getUniqueKeyExporter, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, hasAlterTable, hasDataTypeBeforeGeneratedAs, inlineLiteral, isAnsiNullOn, isEmptyStringTreatedAsNull, isLob, isLockTimeoutParameterized, ordinal, prependComment, quote, quoteCollation, registerKeyword, registerKeywords, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeLength, rowId, rowIdSqlType, supportsBindAsCallableArgument, supportsBitType, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsDistinctFromPredicate, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsFetchClause, supportsFractionalTimestampArithmetic, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeTypeName, supportsInsertReturningGeneratedKeys, supportsJdbcConnectionLobCreation, supportsMaterializedLobAccess, supportsNamedParameters, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsParametersInInsertSelect, supportsPartitionBy, supportsPredicateAsExpression, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsTupleDistinctCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsValuesList, supportsValuesListForInsert, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, translateExtractField, trimPattern, useArrayForMultiValuedParameters, useFollowOnLocking, useInputStreamToInsertBlob
-
-
-
-
Constructor Detail
-
MariaDBDialect
public MariaDBDialect()
-
MariaDBDialect
public MariaDBDialect(DatabaseVersion version)
-
MariaDBDialect
public MariaDBDialect(DialectResolutionInfo info)
-
-
Method Detail
-
getMySQLVersion
public DatabaseVersion getMySQLVersion()
- Overrides:
getMySQLVersion
in classMySQLDialect
-
getMinimumSupportedVersion
protected DatabaseVersion getMinimumSupportedVersion()
Description copied from class:Dialect
Get the version of the SQL dialect that is the minimum supported by this implementation.- Overrides:
getMinimumSupportedVersion
in classMySQLDialect
-
getNationalizationSupport
public NationalizationSupport getNationalizationSupport()
Description copied from class:Dialect
Determines whether this database requires the use of explicitly nationalized character (Unicode) data types.That is, whether the use of
Types.NCHAR
,Types.NVARCHAR
, andTypes.NCLOB
is required for nationalized character data.- Overrides:
getNationalizationSupport
in classDialect
-
initializeFunctionRegistry
public void initializeFunctionRegistry(FunctionContributions functionContributions)
Description copied from class:Dialect
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
-
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])
java.time
types:-
local date
-
local time
-
local datetime
-
offset datetime
-
instant
-
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 ofcast(a as String)
-
ifnull(arg0, arg1)
- synonym ofcoalesce(a, b)
extract()
, and desugared by the parser:-
second(arg)
- synonym ofextract(second from a)
-
minute(arg)
- synonym ofextract(minute from a)
-
hour(arg)
- synonym ofextract(hour from a)
-
day(arg)
- synonym ofextract(day from a)
-
month(arg)
- synonym ofextract(month from a)
-
year(arg)
- synonym ofextract(year from a)
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.- Overrides:
initializeFunctionRegistry
in classMySQLDialect
-
-
registerColumnTypes
protected void registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Description copied from class:Dialect
Register ANSI-standard column types using the length limits defined byDialect.getMaxVarcharLength()
,Dialect.getMaxNVarcharLength()
, andDialect.getMaxVarbinaryLength()
.This method is always called when a
Dialect
is instantiated.- Overrides:
registerColumnTypes
in classMySQLDialect
-
resolveSqlTypeDescriptor
public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
Description copied from class:Dialect
Assigns an appropriateJdbcType
to a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.- Overrides:
resolveSqlTypeDescriptor
in classMySQLDialect
- Parameters:
columnTypeName
- the column type namejdbcTypeCode
- thetype code
precision
- the precision or 0scale
- the scale or 0- Returns:
- an appropriate instance of
JdbcType
-
contributeTypes
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Description copied from class:Dialect
A callback which allows theDialect
to contribute types.- Overrides:
contributeTypes
in classMySQLDialect
- Parameters:
typeContributions
- Callback to contribute the typesserviceRegistry
- The service registry
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Description copied from class:Dialect
- Overrides:
getSqlAstTranslatorFactory
in classMySQLDialect
- See Also:
StandardSqlAstTranslatorFactory
,JdbcEnvironment.getSqlAstTranslatorFactory()
-
supportsWindowFunctions
public boolean supportsWindowFunctions()
Description copied from class:Dialect
Does this dialect support window functions likerow_number() over (..)
?- Overrides:
supportsWindowFunctions
in classMySQLDialect
- Returns:
true
if the underlying database supports window functions,false
otherwise. The default isfalse
.
-
supportsLateral
public boolean supportsLateral()
Description copied from class:Dialect
Does this dialect support the SQLlateral
keyword or a proprietary alternative?- Overrides:
supportsLateral
in classMySQLDialect
- Returns:
true
if the underlying database supports lateral,false
otherwise. The default isfalse
.
-
supportsRecursiveCTE
public boolean supportsRecursiveCTE()
Description copied from class:Dialect
Does this dialect/database support recursive CTEs?- Overrides:
supportsRecursiveCTE
in classMySQLDialect
- Returns:
true
if recursive CTEs are supported
-
supportsColumnCheck
public boolean supportsColumnCheck()
Description copied from class:Dialect
Does this dialect support column-level check constraints?- Overrides:
supportsColumnCheck
in classMySQLDialect
- Returns:
- True if column-level
check
constraints are supported; false otherwise.
-
getDefaultMySQLStorageEngine
protected MySQLStorageEngine getDefaultMySQLStorageEngine()
- Overrides:
getDefaultMySQLStorageEngine
in classMySQLDialect
-
supportsIfExistsBeforeConstraintName
public boolean supportsIfExistsBeforeConstraintName()
Description copied from class:Dialect
For dropping a constraint with analter table
statement, can the phraseif exists
be applied before the constraint name?- Overrides:
supportsIfExistsBeforeConstraintName
in classDialect
- Returns:
true
ifif exists
can be applied before the constraint name
-
supportsIfExistsAfterAlterTable
public boolean supportsIfExistsAfterAlterTable()
Description copied from class:Dialect
For analter table
, can the phraseif exists
be applied?- Overrides:
supportsIfExistsAfterAlterTable
in classDialect
- Returns:
true
ifif exists
can be applied afteralter table
-
getSequenceSupport
public SequenceSupport getSequenceSupport()
Description copied from class:MySQLDialect
No support for sequences.- Overrides:
getSequenceSupport
in classMySQLDialect
-
getQuerySequencesString
public String getQuerySequencesString()
Description copied from class:Dialect
Get theselect
command used retrieve the names of all sequences.- Overrides:
getQuerySequencesString
in classDialect
- Returns:
- The select command; or null if sequences are not supported.
-
getSequenceInformationExtractor
public SequenceInformationExtractor getSequenceInformationExtractor()
Description copied from class:Dialect
ASequenceInformationExtractor
which is able to extractSequenceInformation
from the JDBC result set returned whenDialect.getQuerySequencesString()
is executed.- Overrides:
getSequenceInformationExtractor
in classDialect
-
supportsSkipLocked
public boolean supportsSkipLocked()
Description copied from class:Dialect
Does this dialect supportSKIP_LOCKED
timeout.- Overrides:
supportsSkipLocked
in classMySQLDialect
- Returns:
true
if SKIP_LOCKED is supported
-
supportsNoWait
public boolean supportsNoWait()
Description copied from class:Dialect
Does this dialect supportNO_WAIT
timeout.- Overrides:
supportsNoWait
in classMySQLDialect
- Returns:
true
ifNO_WAIT
is supported
-
supportsWait
public boolean supportsWait()
Description copied from class:Dialect
Does this dialect supportWAIT
timeout.- Overrides:
supportsWait
in classMySQLDialect
- Returns:
true
ifWAIT
is supported
-
supportsInsertReturning
public boolean supportsInsertReturning()
Description copied from class:Dialect
Does this dialect fully support returning arbitrary generated column values after execution of aninsert
statement, using native SQL syntax?Support for identity columns is insufficient here, we require something like:
insert ... returning ...
select from final table (insert ... )
- Overrides:
supportsInsertReturning
in classDialect
- Returns:
true
for 10.5 and above because Maria supportsinsert ... returning
even though MySQL does not- See Also:
OnExecutionGenerator.getGeneratedIdentifierDelegate(org.hibernate.id.PostInsertIdentityPersister)
,InsertReturningDelegate
-
getFunctionalDependencyAnalysisSupport
public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport()
Description copied from class:Dialect
Get this dialect's level of support for primary key functional dependency analysis withinGROUP BY
andORDER BY
clauses.- Overrides:
getFunctionalDependencyAnalysisSupport
in classMySQLDialect
-
buildIdentifierHelper
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException
Description copied from class:Dialect
TheIdentifierHelper
indicated by this dialect for handling identifier conversions. Returningnull
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:
IdentifierHelperBuilder.isGloballyQuoteIdentifiers()
IdentifierHelperBuilder.getUnquotedCaseStrategy()
- initialized to UPPERIdentifierHelperBuilder.getQuotedCaseStrategy()
- initialized to MIXED
By default, Hibernate will do the following:
- Call
IdentifierHelperBuilder.applyIdentifierCasing(DatabaseMetaData)
- Call
IdentifierHelperBuilder.applyReservedWords(DatabaseMetaData)
- Applies
AnsiSqlKeywords.sql2003()
as reserved words - Applies the {#link #sqlKeywords} collected here as reserved words
- Applies the Dialect's
NameQualifierSupport
, if it defines one
- Overrides:
buildIdentifierHelper
in classMySQLDialect
- Parameters:
builder
- A partially-configuredIdentifierHelperBuilder
.dbMetaData
- Access to the metadata returned from the driver if needed and if available. WARNING: it may benull
.- Returns:
- The
IdentifierHelper
instance to use, ornull
to indicate Hibernate should use its fallback path - Throws:
SQLException
- Accessing theDatabaseMetaData
can throw it. Just rethrow and Hibernate will handle it.- See Also:
Dialect.getNameQualifierSupport()
-
-