Class Dialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- All Implemented Interfaces:
ConversionContext
- Direct Known Subclasses:
AbstractHANADialect
,AbstractTransactSQLDialect
,CockroachDialect
,DB2Dialect
,DerbyDialect
,H2Dialect
,HSQLDialect
,MySQLDialect
,OracleDialect
,PostgreSQLDialect
,SpannerDialect
public abstract class Dialect extends Object implements ConversionContext
Represents a dialect of SQL implemented by a particular RDBMS. Every subclass of this class implements support for a certain database platform. For example,PostgreSQLDialect
implements support for PostgreSQL, andMySQLDialect
implements support for MySQL.A subclass must provide a public constructor with a single parameter of type
DialectResolutionInfo
. Alternatively, for purposes of backward compatibility with older versions of Hibernate, a constructor with no parameters is also allowed.Almost every subclass must, as a bare minimum, override at least:
registerColumnTypes(TypeContributions, ServiceRegistry)
to define a mapping from SQL type codes to database column types, andinitializeFunctionRegistry(QueryEngine)
to register mappings for standard HQL functions with theSqmFunctionRegistry
.
Subclasses should be threadsafe and immutable.
Since Hibernate 6, a single subclass of
Dialect
represents all releases of a given product-specific SQL dialect. The version of the database is exposed at runtime via theDialectResolutionInfo
passed to the constructor, and by thegetVersion()
property.Programs using Hibernate should migrate away from the use of versioned dialect classes like, for example,
PostgreSQL95Dialect
. These classes are now deprecated and will be removed in a future release.A custom
Dialect
may be specified using the configuration property "hibernate.dialect", but for supported databases this property is unnecessary, and Hibernate will select the correctDialect
based on the JDBC URL andDialectResolutionInfo
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Dialect.SizeStrategy
Pluggable strategy for determining theSize
to use for columns of a given SQL type.class
Dialect.SizeStrategyImpl
-
Field Summary
Fields Modifier and Type Field Description static String
CLOSED_QUOTE
Characters used as closing for quoting SQL identifiersprotected static LobMergeStrategy
LEGACY_LOB_MERGE_STRATEGY
The legacy behavior of Hibernate.protected static double
LOG_BASE2OF10
protected static LobMergeStrategy
NEW_LOCATOR_LOB_MERGE_STRATEGY
Merge strategy based on creating a new LOB locator.static String
QUOTE
Characters used as opening for quoting SQL identifiersprotected BatchLoadSizingStrategy
STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY
protected static LobMergeStrategy
STREAM_XFER_LOB_MERGE_STRATEGY
Merge strategy based on transferring contents based on streams.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Dialect()
Deprecated.provide aDatabaseVersion
protected
Dialect(DatabaseVersion version)
protected
Dialect(DialectResolutionInfo info)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
addSqlHintOrComment(String sql, QueryOptions queryOptions, boolean commentsEnabled)
Modify the SQL, adding hints or comments, if necessaryvoid
appendArrayLiteral(SqlAppender appender, Object[] literal, JdbcLiteralFormatter<Object> elementFormatter, WrapperOptions wrapperOptions)
void
appendBinaryLiteral(SqlAppender appender, byte[] bytes)
void
appendBooleanValueString(SqlAppender appender, boolean bool)
void
appendDatetimeFormat(SqlAppender appender, String format)
Translate the given datetime format string from the pattern language defined by Java'sDateTimeFormatter
to whatever pattern language is understood by the native datetime formatting function for this database (often theto_char()
function).void
appendDateTimeLiteral(SqlAppender appender, TemporalAccessor temporalAccessor, jakarta.persistence.TemporalType precision, TimeZone jdbcTimeZone)
void
appendDateTimeLiteral(SqlAppender appender, Calendar calendar, jakarta.persistence.TemporalType precision, TimeZone jdbcTimeZone)
void
appendDateTimeLiteral(SqlAppender appender, Date date, jakarta.persistence.TemporalType precision, TimeZone jdbcTimeZone)
void
appendIntervalLiteral(SqlAppender appender, Duration literal)
void
appendLiteral(SqlAppender appender, String literal)
String
appendLockHint(LockOptions lockOptions, String tableName)
Some dialects support an alternative means toSELECT FOR UPDATE
, whereby a "lock hint" is appended to the table name in the from clause.void
appendUUIDLiteral(SqlAppender appender, UUID literal)
String
applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String,String[]> keyColumnNames)
Modifies the given SQL by applying the appropriate updates for the specified lock modes and key columns.void
augmentPhysicalTableTypes(List<String> tableTypesList)
void
augmentRecognizedTableTypes(List<String> tableTypesList)
IdentifierHelper
buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
Build the IdentifierHelper indicated by this Dialect for handling identifier conversions.SQLExceptionConversionDelegate
buildSQLExceptionConversionDelegate()
Build an instance of aSQLExceptionConversionDelegate
for interpreting dialect-specific error or SQLState codes.boolean
canBatchTruncate()
Does thetruncate table
statement accept multiple tables?boolean
canCreateCatalog()
Does this dialect support catalog creation?boolean
canCreateSchema()
Does this dialect support schema creation?boolean
canDisableConstraints()
Is there some way to disable foreign key constraint checking while truncating tables? (If there's no way to do it, and if we can't batch truncate, we must drop and recreate the constraints instead.)String
castPattern(CastType from, CastType to)
Obtain a pattern for the SQL equivalent to acast()
function call.protected String
castType(int sqlTypeCode)
protected void
checkVersion()
char
closeQuote()
The character specific to this dialect used to close a quoted identifier.protected String
columnType(int sqlTypeCode)
void
contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Allows the Dialect to contribute additional typesMutationOperation
createUpsertOperation(EntityMutationTarget mutationTarget, TableUpsert tableUpsert, SessionFactoryImplementor factory)
String
currentDate()
Translation of the HQL/JPQLcurrent_date
function, which maps to the Java typejava.sql.Date
, and of the HQLlocal_date
function which maps to the Java typejava.sql.LocalDate
.String
currentLocalTime()
Translation of the HQLlocal_time
function, which maps to the Java typejava.time.LocalTime
which is a time with no time zone.String
currentLocalTimestamp()
Translation of the HQLlocal_datetime
function, which maps to the Java typejava.time.LocalDateTime
which is a datetime with no time zone.String
currentTime()
Translation of the HQL/JPQLcurrent_time
function, which maps to the Java typejava.sql.Time
which is a time with no time zone.String
currentTimestamp()
Translation of the HQL/JPQLcurrent_timestamp
function, which maps to the Java typejava.sql.Timestamp
which is a datetime with no time zone.String
currentTimestampWithTimeZone()
Translation of the HQLoffset_datetime
function, which maps to the Java typejava.time.OffsetDateTime
which is a datetime with a time zone.ScrollMode
defaultScrollMode()
Certain dialects support a subset ofScrollMode
s.boolean
doesReadCommittedCauseWritersToBlockReaders()
For the underlying database, isREAD_COMMITTED
isolation implemented by forcing readers to wait for write locks to be released?boolean
doesRepeatableReadCauseReadersToBlockWriters()
For the underlying database, isREPEATABLE_READ
isolation implemented by forcing writers to wait for read locks to be released?boolean
dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?boolean
equivalentTypes(int typeCode1, int typeCode2)
Do the given JDBC type codes, as defined inTypes
represent essentially the same type in this dialect of SQL?static String
escapeComment(String comment)
String
extractPattern(TemporalUnit unit)
Obtain a pattern for the SQL equivalent to anextract()
function call.boolean
forceLobAsLastValue()
HHH-4635 Oracle expects all Lob values to be last in inserts and updates.String
generatedAs(String generatedAs)
Thegenerated as
clause, or similar, for generated column declarations in DDL statements.String
getAddColumnString()
The syntax used to add a column to a table (optional).String
getAddColumnSuffixString()
The syntax for the suffix used to add a column to a table (optional).String
getAddForeignKeyConstraintString(String constraintName, String foreignKeyDefinition)
String
getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table.String
getAddPrimaryKeyConstraintString(String constraintName)
The syntax used to add a primary key constraint to a table.AggregateSupport
getAggregateSupport()
How the Dialect supports aggregate types likeSqlTypes.STRUCT
.String
getAlterColumnTypeString(String columnName, String columnType, String columnDefinition)
String
getAlterTableString(String tableName)
Command used to alter a table.String
getArrayTypeName(String elementTypeName)
The SQL type name for the array of the given type name.Exporter<AuxiliaryDatabaseObject>
getAuxiliaryDatabaseObjectExporter()
CallableStatementSupport
getCallableStatementSupport()
String
getCascadeConstraintsString()
The keyword that specifies that adrop table
operation should be cascaded to its constraints, typically" cascade"
where the leading space is required, or the empty string if there is no such keyword in this dialect.String
getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive like comparison.String
getCheckCondition(String columnName, long min, long max)
Render a SQL check condition for a column that represents an enumerated value.String
getCheckCondition(String columnName, String[] values)
Render a SQL check condition for a column that represents an enumerated value.ColumnAliasExtractor
getColumnAliasExtractor()
String
getColumnComment(String comment)
Get the comment into a form supported for column definition.String[]
getCreateCatalogCommand(String catalogName)
Get the SQL command used to create the named catalogString
getCreateIndexString(boolean unique)
String
getCreateIndexTail(boolean unique, List<Column> columns)
String
getCreateMultisetTableString()
Slight variation ongetCreateTableString()
.String[]
getCreateSchemaCommand(String schemaName)
Get the SQL command used to create the named schemaString
getCreateTableString()
Command used to create a table.String
getCreateTemporaryTableColumnAnnotation(int sqlTypeCode)
Annotation to be appended to the end of each COLUMN clause for temporary tables.String
getCreateUserDefinedTypeExtensionsString()
String
getCreateUserDefinedTypeKindString()
Command used to create a table.String
getCurrentSchemaCommand()
Get the SQL command used to retrieve the current schema name.String
getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the database.BatchLoadSizingStrategy
getDefaultBatchLoadSizingStrategy()
int
getDefaultDecimalPrecision()
This is the default precision for a generated column mapped to aBigInteger
orBigDecimal
.long
getDefaultLobLength()
boolean
getDefaultNonContextualLobCreation()
The default value to use for the configuration property "hibernate.jdbc.lob.non_contextual_creation".Properties
getDefaultProperties()
Retrieve a set of default Hibernate properties for this database.int
getDefaultStatementBatchSize()
The default value to use for the configuration property "hibernate.jdbc.batch_size".int
getDefaultTimestampPrecision()
This is the default precision for a generated column mapped to aTimestamp
orLocalDateTime
.boolean
getDefaultUseGetGeneratedKeys()
The default value to use for the configuration property "hibernate.jdbc.use_get_generated_keys".String
getDisableConstraintsStatement()
A SQL statement that temporarily disables foreign key constraint checking for all tables.String
getDisableConstraintStatement(String tableName, String name)
A SQL statement that temporarily disables checking of the given foreign key constraint.int
getDoublePrecision()
This is the default precision for a generated column mapped to a JavaDouble
ordouble
.String[]
getDropCatalogCommand(String catalogName)
Get the SQL command used to drop the named catalogString
getDropForeignKeyString()
Thealter table
subcommand used to drop a foreign key constraint.String[]
getDropSchemaCommand(String schemaName)
Get the SQL command used to drop the named schemaString
getDropTableString(String tableName)
Generate aDROP TABLE
statementString
getDropUniqueKeyString()
Thealter table
subcommand used to drop a unique key constraint.String
getEnableConstraintsStatement()
A SQL statement that re-enables foreign key constraint checking for all tables.String
getEnableConstraintStatement(String tableName, String name)
A SQL statement that re-enables checking of the given foreign key constraint.String
getEnumTypeDeclaration(String[] values)
SchemaManagementTool
getFallbackSchemaManagementTool(Map<String,Object> configurationValues, ServiceRegistryImplementor registry)
The SchemaManagementTool to use if none explicitly specified.SqmMultiTableInsertStrategy
getFallbackSqmInsertStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
SqmMultiTableMutationStrategy
getFallbackSqmMutationStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
int
getFloatPrecision()
This is the default precision for a generated column mapped to a JavaFloat
orfloat
.Exporter<ForeignKey>
getForeignKeyExporter()
String
getForUpdateNowaitString()
Retrieves theFOR UPDATE NOWAIT
syntax specific to this dialect.String
getForUpdateNowaitString(String aliases)
Get theFOR UPDATE OF column_list NOWAIT
fragment appropriate for this dialect given the aliases of the columns to be write locked.String
getForUpdateSkipLockedString()
Retrieves theFOR UPDATE SKIP LOCKED
syntax specific to this dialect.String
getForUpdateSkipLockedString(String aliases)
Get theFOR UPDATE OF column_list SKIP LOCKED
fragment appropriate for this dialect given the aliases of the columns to be write locked.String
getForUpdateString()
Get the string to append to SELECT statements to acquire locks for this dialect.String
getForUpdateString(String aliases)
Get theFOR UPDATE OF column_list
fragment appropriate for this dialect given the aliases of the columns to be write locked.String
getForUpdateString(String aliases, LockOptions lockOptions)
Get theFOR UPDATE OF
orFOR SHARE OF
fragment appropriate for this dialect given the aliases of the columns to be locked.String
getForUpdateString(LockMode lockMode)
Given a lock mode, determine the appropriate for update fragment to use.String
getForUpdateString(LockOptions lockOptions)
Given LockOptions (lockMode, timeout), determine the appropriate for update fragment to use.long
getFractionalSecondPrecisionInNanos()
The "native" precision for arithmetic with datetimes and day-to-second durations.SelectItemReferenceStrategy
getGroupBySelectItemReferenceStrategy()
HqlTranslator
getHqlTranslator()
Return anHqlTranslator
specific to this dialect.IdentityColumnSupport
getIdentityColumnSupport()
Get the appropriateIdentityColumnSupport
Exporter<Index>
getIndexExporter()
int
getInExpressionCountLimit()
Return the limit that the underlying database places on the number of elements in anIN
predicate.Set<String>
getKeywords()
The keywords of the SQL dialectLimitHandler
getLimitHandler()
Returns aLimitHandler
that implements support forQuery.setMaxResults(int)
andQuery.setFirstResult(int)
for this dialect.LobMergeStrategy
getLobMergeStrategy()
LockingStrategy
getLockingStrategy(Lockable lockable, LockMode lockMode)
Get a strategy instance which knows how to acquire a database-level lock of the specified mode for this dialect.RowLockStrategy
getLockRowIdentifier(LockMode lockMode)
String
getLowercaseFunction()
The name of the SQL function that transforms a string to lowercaseint
getMaxAliasLength()
What is the maximum length Hibernate can use for generated aliases?int
getMaxIdentifierLength()
What is the maximum identifier length supported by the dialect?int
getMaxNVarcharCapacity()
The longest possible length of aTypes.NVARCHAR
-like column.int
getMaxNVarcharLength()
The biggest size value that can be supplied as argument to aTypes.NVARCHAR
-like type.int
getMaxVarbinaryCapacity()
The longest possible length of aTypes.VARBINARY
-like column.int
getMaxVarbinaryLength()
The biggest size value that can be supplied as argument to aTypes.VARBINARY
-like type.int
getMaxVarcharCapacity()
The longest possible length of aTypes.VARCHAR
-like column.int
getMaxVarcharLength()
The biggest size value that can be supplied as argument to aTypes.VARCHAR
-like type.protected DatabaseVersion
getMinimumSupportedVersion()
NameQualifierSupport
getNameQualifierSupport()
By default interpret this based on DatabaseMetaData.NationalizationSupport
getNationalizationSupport()
Determines whether this database requires the use of explicit nationalized character data types.String
getNativeIdentifierGeneratorStrategy()
Resolves the native generation strategy associated to this dialect.String
getNoColumnsInsertString()
Deprecated.Override the methodrenderInsertIntoNoColumns()
on thetranslator
returned by this dialectString
getNullColumnString()
The keyword used to specify a nullable column.String
getNullColumnString(String columnType)
The keyword used to specify a nullable column.NullOrdering
getNullOrdering()
Returns the ordering of null.int
getPreferredSqlTypeCodeForArray()
The JDBCtype code
to use for mapping properties of basic Java array orCollection
types.int
getPreferredSqlTypeCodeForBoolean()
The JDBCtype code
to use for mapping properties of Java typeboolean
.String
getQueryHintString(String query, String hints)
Apply a hint to the query.String
getQueryHintString(String query, List<String> hintList)
Apply a hint to the query.String
getQuerySequencesString()
Get the select command used retrieve the names of all sequences.String
getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire READ locks for this dialect.String
getReadLockString(String aliases, int timeout)
Get the string to append to SELECT statements to acquire READ locks for this dialect given the aliases of the columns to be read locked.RowLockStrategy
getReadRowLockStrategy()
The row lock strategy to use for read locks.ResultSet
getResultSet(CallableStatement statement)
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
from the OUT parameter.ResultSet
getResultSet(CallableStatement statement, int position)
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
.ResultSet
getResultSet(CallableStatement statement, String name)
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
from the OUT parameter.SchemaNameResolver
getSchemaNameResolver()
Get the strategy for determining the schema name of a ConnectionString
getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration)
Given aTypes
type code, determine an appropriate null value to use in a select clause.String
getSelectGUIDString()
Get the command used to select a GUID from the underlying database.Exporter<Sequence>
getSequenceExporter()
SequenceInformationExtractor
getSequenceInformationExtractor()
A source ofSequenceInformation
.SequenceSupport
getSequenceSupport()
Dialect.SizeStrategy
getSizeStrategy()
SqlAstTranslatorFactory
getSqlAstTranslatorFactory()
Return aSqlAstTranslatorFactory
specific to this dialect.SqmTranslatorFactory
getSqmTranslatorFactory()
Return aSqmTranslatorFactory
specific to this dialect.TemporaryTableKind
getSupportedTemporaryTableKind()
Cleaner
getTableCleaner()
String
getTableComment(String comment)
Get the comment into a form supported for table definition.Exporter<Table>
getTableExporter()
TableMigrator
getTableMigrator()
String
getTableTypeString()
AfterUseAction
getTemporaryTableAfterUseAction()
BeforeUseAction
getTemporaryTableBeforeUseAction()
String
getTemporaryTableCreateCommand()
String
getTemporaryTableCreateOptions()
TempTableDdlTransactionHandling
getTemporaryTableDdlTransactionHandling()
String
getTemporaryTableDropCommand()
TemporaryTableExporter
getTemporaryTableExporter()
String
getTemporaryTableTruncateCommand()
TimeZoneSupport
getTimeZoneSupport()
How the Dialect supports time zone types likeTypes.TIMESTAMP_WITH_TIMEZONE
.String
getTruncateTableStatement(String tableName)
A SQL statement that truncates the given table.String[]
getTruncateTableStatements(String[] tableNames)
A SQL statement or statements that truncate the given tables.UniqueDelegate
getUniqueDelegate()
Get theUniqueDelegate
supported by this dialectExporter<Constraint>
getUniqueKeyExporter()
String
getUserDefinedTypeComment(String comment)
Get the comment into a form supported for UDT definition.Exporter<UserDefinedType>
getUserDefinedTypeExporter()
DatabaseVersion
getVersion()
ViolatedConstraintNameExtractor
getViolatedConstraintNameExtractor()
String
getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect.String
getWriteLockString(String aliases, int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect given the aliases of the columns to be write locked.RowLockStrategy
getWriteRowLockStrategy()
The row lock strategy to use for write locks.boolean
hasAlterTable()
Does this dialect support theALTER TABLE
syntax?boolean
hasDataTypeBeforeGeneratedAs()
Is an explicit column type required forgenerated as
columns?boolean
hasSelfReferentialForeignKeyBug()
Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?protected void
initDefaultProperties()
Set appropriate default values for configuration properties.void
initializeFunctionRegistry(QueryEngine queryEngine)
Initialize the given registry with any dialect-specific functions.String
inlineLiteral(String literal)
Inline String literal.boolean
isAnsiNullOn()
boolean
isCurrentTimestampSelectStringCallable()
Should the value returned bygetCurrentTimestampSelectString()
be treated as callable.boolean
isEmptyStringTreatedAsNull()
Return whether the dialect considers an empty-string value as null.boolean
isJdbcLogWarningsEnabledByDefault()
Is JDBC statement warning logging enabled by default?boolean
isLockTimeoutParameterized()
If this dialect supports specifying lock timeouts, are those timeouts rendered into theSQL
string as parameters.char
openQuote()
The character specific to this dialect used to begin a quoted identifier.protected String
prependComment(String sql, String comment)
boolean
qualifyIndexName()
Do we need to qualify index names with the schema name?String
quote(String name)
Apply dialect-specific quoting.protected void
registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Register ANSI-standard column types using the length limits defined bygetMaxVarcharLength()
,getMaxNVarcharLength()
, andgetMaxVarbinaryLength()
.protected void
registerDefaultKeywords()
protected void
registerKeyword(String word)
protected void
registerKeywords(DialectResolutionInfo info)
int
registerResultSetOutParameter(CallableStatement statement, int position)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet
*by position*.int
registerResultSetOutParameter(CallableStatement statement, String name)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet
*by name*.boolean
requiresCastForConcatenatingNonStrings()
Does this dialect/database require casting of non-string arguments in a concat function?boolean
requiresFloatCastingOfIntegerDivision()
Does this dialect require that integer divisions be wrapped incast()
calls to tell the db parser the expected type.boolean
requiresParensForTupleCounts()
IfsupportsTupleCounts()
is true, does this dialect require the tuple to be delimited with parens?boolean
requiresParensForTupleDistinctCounts()
IfsupportsTupleDistinctCounts()
is true, does this dialect require the tuple to be delimited with parens?protected Integer
resolveSqlTypeCode(String typeName, String baseTypeName, TypeConfiguration typeConfiguration)
Resolves theSqlTypes
type code for the given column type name as reported by the database and the base type name (i.e.protected Integer
resolveSqlTypeCode(String columnTypeName, TypeConfiguration typeConfiguration)
Resolves theSqlTypes
type code for the given column type name as reported by the database, ornull
if it can't be resolved.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.int
resolveSqlTypeLength(String columnTypeName, int jdbcTypeCode, int precision, int scale, int displaySize)
boolean
supportsAlterColumnType()
boolean
supportsBindAsCallableArgument()
Does this dialect support using a JDBC bind parameter as an argument to a function or procedure call?boolean
supportsBitType()
boolean
supportsCascadeDelete()
Does this dialect supporton delete
actions in foreign key definitions?boolean
supportsCaseInsensitiveLike()
Does this dialect support case insensitive LIKE restrictions?boolean
supportsCircularCascadeDeleteConstraints()
Does this dialect support definition of cascade delete constraints which can cause circular chains?boolean
supportsColumnCheck()
Does this dialect support column-level check constraints?boolean
supportsCommentOn()
Does this dialect support commenting on tables and columns?boolean
supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current timestamp value?boolean
supportsDistinctFromPredicate()
Does this dialect support some kind ofdistinct from
predicate?boolean
supportsExistsInSelect()
Does the dialect support an exists statement in the select clause?boolean
supportsExpectedLobUsagePattern()
Expected LOB usage pattern is such that I can perform an insert via prepared statement with a parameter binding for a LOB value without crazy casting to JDBC driver implementation-specific classes...boolean
supportsFetchClause(FetchClauseType type)
Does this dialect support the given fetch clause type.boolean
supportsFractionalTimestampArithmetic()
Whether the database supports adding a fractional interval to a timestamp e.g.boolean
supportsIfExistsAfterAlterTable()
For analter table
, can the phrase "if exists
be applied?boolean
supportsIfExistsAfterConstraintName()
For dropping a constraint with analter table
, can the phraseif exists
be applied after the constraint name?boolean
supportsIfExistsAfterTableName()
For dropping a table, can the phraseif exists
be applied after the table name?boolean
supportsIfExistsAfterTypeName()
For dropping a type, can the phraseif exists
be applied after the type name?boolean
supportsIfExistsBeforeConstraintName()
For dropping a constraint with analter table
statement, can the phraseif exists
be applied before the constraint name?boolean
supportsIfExistsBeforeTableName()
For dropping a table, can the phrase "if exists
be applied before the table name?boolean
supportsIfExistsBeforeTypeName()
For dropping a type, can the phrase "if exists
be applied before the type name?boolean
supportsInsertReturning()
Does this dialect fully support returning arbitrary generated column values after execution of aninsert
statement, using native SQL syntax?boolean
supportsInsertReturningGeneratedKeys()
Does this dialect fully support returning arbitrary generated column values after execution of aninsert
statement, using the JDBC methodConnection.prepareStatement(String, String[])
.boolean
supportsJdbcConnectionLobCreation(DatabaseMetaData databaseMetaData)
Check whether the JDBCConnection
supports creating LOBs viaConnection.createBlob()
,Connection.createNClob()
, orConnection.createClob()
.boolean
supportsLateral()
Does this dialect support the SQLlateral
keyword or a proprietary alternative?boolean
supportsLobValueChangePropagation()
Does the dialect support propagating changes to LOB values back to the database? Talking about mutating the internal value of the locator as opposed to supplying a new locator instance...boolean
supportsLockTimeouts()
Informational metadata about whether this dialect is known to support specifying timeouts for requested lock acquisitions.boolean
supportsMaterializedLobAccess()
Check whether the JDBC driver allows setting LOBs viaPreparedStatement.setBytes(int, byte[])
,PreparedStatement.setNString(int, String)
orPreparedStatement.setString(int, String)
APIs.boolean
supportsNamedParameters(DatabaseMetaData databaseMetaData)
Override the DatabaseMetaData#supportsNamedParameters()boolean
supportsNoColumnsInsert()
Check if the INSERT statement is allowed to contain no column.boolean
supportsNonQueryWithCTE()
Does this dialect support insert, update, and delete statements with Common Table Expressions?boolean
supportsNoWait()
Does this dialect supportNO_WAIT
timeout.boolean
supportsNullPrecedence()
boolean
supportsOffsetInSubquery()
Does this dialect supportoffset
in subqueries? For example:select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1 offset 1)
boolean
supportsOrderByInSubquery()
Does this dialect support theorder by
clause in subqueries? For example:select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1)
boolean
supportsOrdinalSelectItemReference()
Does this dialect support references to result variables (i.e, select items) by column positions (1-origin) as defined by the select clause?boolean
supportsOuterJoinForUpdate()
Does this dialect supportFOR UPDATE
in conjunction with outer joined rows?boolean
supportsParametersInInsertSelect()
Does this dialect support parameters within theSELECT
clause ofINSERT ... SELECT ...
statements?boolean
supportsPartitionBy()
Does the underlying database support partition by?protected boolean
supportsPredicateAsExpression()
Whether a predicate like `a > 0` can appear in an expression context e.g.boolean
supportsRecursiveCTE()
Does this dialect/database support recursive CTEs (Common Table Expressions)?boolean
supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
Does this dialect support asking the result set its positioning information on forward only cursors.boolean
supportsSkipLocked()
Does this dialect supportSKIP_LOCKED
timeout.boolean
supportsStandardArrays()
Database has native support for SQL standard arrays which can be referred to by its base type name.boolean
supportsStandardCurrentTimestampFunction()
Does this database have an ANSI-SQLcurrent_timestamp
function?boolean
supportsSubqueryInSelect()
Does this dialect support subqueries in theselect
clause? For example:select col1, (select col2 from Table2 where ...) from Table1
boolean
supportsSubqueryOnMutatingTable()
Does this dialect support referencing the table being mutated in a subquery? The "table being mutated" is the table referenced in an update or delete query.boolean
supportsSubselectAsInPredicateLHS()
Are subselects supported as the left-hand-side (LHS) of IN-predicates.boolean
supportsTableCheck()
Does this dialect support table-level check constraints?boolean
supportsTemporalLiteralOffset()
Whether the Dialect supports timezone offset in temporal literals.boolean
supportsTemporaryTablePrimaryKey()
boolean
supportsTemporaryTables()
boolean
supportsTruncateWithCast()
Does this dialect support truncation of values to a specified length through a cast?boolean
supportsTupleCounts()
Does this dialect supportcount(a,b)
?boolean
supportsTupleDistinctCounts()
Does this dialect supportcount(distinct a,b)
?boolean
supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in which it was created?boolean
supportsUnionAll()
Does this dialect support UNION ALL.boolean
supportsUnionInSubquery()
Does this dialect support UNION in a subquery.boolean
supportsValuesList()
Does this dialect supportvalues
lists of formVALUES (1), (2), (3)
?boolean
supportsValuesListForInsert()
Does this dialect supportvalues
lists of formVALUES (1), (2), (3)
in insert statements?boolean
supportsWait()
Does this dialect supportWAIT
timeout.boolean
supportsWindowFunctions()
Does this dialect support window functions likerow_number() over (..)
?String
timestampaddPattern(TemporalUnit unit, jakarta.persistence.TemporalType temporalType, IntervalType intervalType)
Obtain a pattern for the SQL equivalent to atimestampadd()
function call.String
timestampdiffPattern(TemporalUnit unit, jakarta.persistence.TemporalType fromTemporalType, jakarta.persistence.TemporalType toTemporalType)
Obtain a pattern for the SQL equivalent to atimestampdiff()
function call.String
toBooleanValueString(boolean bool)
The SQL literal value to which this database maps boolean values.String
toQuotedIdentifier(String name)
Apply dialect-specific quoting.String
toString()
String
transformSelectString(String select)
Meant as a means for end users to affect the select strings being sent to the database and perhaps manipulate them in some fashion.String
translateDurationField(TemporalUnit unit)
Return the name used to identify the given unit of duration as an argument to#timestampadd()
or#timestampdiff()
, or of this dialect's equivalent functions.String
translateExtractField(TemporalUnit unit)
Return the name used to identify the given field as an argument to theextract()
function, or of this dialect's equivalent function.String
trimPattern(TrimSpec specification, char character)
Obtain a pattern for the SQL equivalent to atrim()
function call.boolean
useFollowOnLocking(String sql, QueryOptions queryOptions)
Some dialects have trouble applying pessimistic locking depending upon what other query options are specified (paging, ordering, etc).boolean
useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations, that is, usingPreparedStatement.setBinaryStream(int, java.io.InputStream, int)
).boolean
useMaterializedLobWhenCapacityExceeded()
Whether to switch fromVARCHAR
-like types toSqlTypes.MATERIALIZED_CLOB
,NVARCHAR
-like types toSqlTypes.MATERIALIZED_NCLOB
andVARBINARY
-like types toSqlTypes.MATERIALIZED_BLOB
types, when the requested size for a type exceeds thegetMaxVarcharCapacity()
,getMaxNVarcharCapacity()
andgetMaxVarbinaryCapacity()
respectively.
-
-
-
Field Detail
-
QUOTE
public static final String QUOTE
Characters used as opening for quoting SQL identifiers- See Also:
- Constant Field Values
-
CLOSED_QUOTE
public static final String CLOSED_QUOTE
Characters used as closing for quoting SQL identifiers- See Also:
- Constant Field Values
-
LOG_BASE2OF10
protected static final double LOG_BASE2OF10
-
LEGACY_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY
The legacy behavior of Hibernate. LOBs are not processed by merge
-
STREAM_XFER_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy STREAM_XFER_LOB_MERGE_STRATEGY
Merge strategy based on transferring contents based on streams.
-
NEW_LOCATOR_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy NEW_LOCATOR_LOB_MERGE_STRATEGY
Merge strategy based on creating a new LOB locator.
-
STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY
protected final BatchLoadSizingStrategy STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY
-
-
Constructor Detail
-
Dialect
@Deprecated(since="6.0") protected Dialect()
Deprecated.provide aDatabaseVersion
-
Dialect
protected Dialect(DatabaseVersion version)
-
Dialect
protected Dialect(DialectResolutionInfo info)
-
-
Method Detail
-
checkVersion
protected void checkVersion()
-
initDefaultProperties
protected void initDefaultProperties()
Set appropriate default values for configuration properties.
-
registerColumnTypes
protected void registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Register ANSI-standard column types using the length limits defined bygetMaxVarcharLength()
,getMaxNVarcharLength()
, andgetMaxVarbinaryLength()
.This method is always called when a
Dialect
is instantiated.
-
columnType
protected String columnType(int sqlTypeCode)
The database column type name for a given JDBC type code defined inTypes
orSqlTypes
. This default implementation returns the ANSI-standard type name.This method may be overridden by concrete
Dialect
s as an alternative toregisterColumnTypes(TypeContributions, ServiceRegistry)
for simple registrations.Note that:
- Implementations of this method are expected to define a
sensible mapping for
Types.NCLOB
Types.NCHAR
, andTypes.NVARCHAR
. On some database, these types are simply remapped toCLOB
,CHAR
, andVARCHAR
. - Mappings for
Types.TIMESTAMP
andTypes.TIMESTAMP_WITH_TIMEZONE
should support explicit specification of precision if possible. - As specified by
DdlTypeRegistry.getDescriptor(int)
, this method never receivesTypes.LONGVARCHAR
,Types.LONGNVARCHAR
, norTypes.LONGVARBINARY
, which are considered synonyms for their non-LONG
counterparts. - On the other hand, the types
SqlTypes.LONG32VARCHAR
,SqlTypes.LONG32NVARCHAR
, andSqlTypes.LONG32VARBINARY
are not synonyms, and implementations of this method must define sensible mappings, for example to database-nativeTEXT
orCLOB
types.
- Implementations of this method are expected to define a
sensible mapping for
-
castType
protected String castType(int sqlTypeCode)
-
registerDefaultKeywords
protected void registerDefaultKeywords()
-
registerKeywords
protected void registerKeywords(DialectResolutionInfo info)
-
getVersion
public DatabaseVersion getVersion()
-
getMinimumSupportedVersion
protected DatabaseVersion getMinimumSupportedVersion()
-
resolveSqlTypeCode
protected Integer resolveSqlTypeCode(String columnTypeName, TypeConfiguration typeConfiguration)
Resolves theSqlTypes
type code for the given column type name as reported by the database, ornull
if it can't be resolved.
-
resolveSqlTypeCode
protected Integer resolveSqlTypeCode(String typeName, String baseTypeName, TypeConfiguration typeConfiguration)
Resolves theSqlTypes
type code for the given column type name as reported by the database and the base type name (i.e. without precision, length and scale), ornull
if it can't be resolved.
-
resolveSqlTypeDescriptor
public 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.
-
resolveSqlTypeLength
public int resolveSqlTypeLength(String columnTypeName, int jdbcTypeCode, int precision, int scale, int displaySize)
-
getCheckCondition
public String getCheckCondition(String columnName, String[] values)
Render a SQL check condition for a column that represents an enumerated value.
-
getCheckCondition
public String getCheckCondition(String columnName, long min, long max)
Render a SQL check condition for a column that represents an enumerated value.
-
initializeFunctionRegistry
public void initializeFunctionRegistry(QueryEngine queryEngine)
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])
-
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. -
-
currentDate
public String currentDate()
Translation of the HQL/JPQLcurrent_date
function, which maps to the Java typejava.sql.Date
, and of the HQLlocal_date
function which maps to the Java typejava.sql.LocalDate
.
-
currentTime
public String currentTime()
Translation of the HQL/JPQLcurrent_time
function, which maps to the Java typejava.sql.Time
which is a time with no time zone. This contradicts ANSI SQL wherecurrent_time
has the typeTIME WITH TIME ZONE
.It is recommended to override this in dialects for databases which support
localtime
ortime at local
.
-
currentTimestamp
public String currentTimestamp()
Translation of the HQL/JPQLcurrent_timestamp
function, which maps to the Java typejava.sql.Timestamp
which is a datetime with no time zone. This contradicts ANSI SQL wherecurrent_timestamp
has the typeTIMESTAMP WITH TIME ZONE
.It is recommended to override this in dialects for databases which support
localtimestamp
ortimestamp at local
.
-
currentLocalTime
public String currentLocalTime()
Translation of the HQLlocal_time
function, which maps to the Java typejava.time.LocalTime
which is a time with no time zone. It should usually be the same SQL function as forcurrentTime()
.It is recommended to override this in dialects for databases which support
localtime
orcurrent_time at local
.
-
currentLocalTimestamp
public String currentLocalTimestamp()
Translation of the HQLlocal_datetime
function, which maps to the Java typejava.time.LocalDateTime
which is a datetime with no time zone. It should usually be the same SQL function as forcurrentTimestamp()
.It is recommended to override this in dialects for databases which support
localtimestamp
orcurrent_timestamp at local
.
-
currentTimestampWithTimeZone
public String currentTimestampWithTimeZone()
Translation of the HQLoffset_datetime
function, which maps to the Java typejava.time.OffsetDateTime
which is a datetime with a time zone. This in principle correctly maps to the ANSI SQLcurrent_timestamp
which has the typeTIMESTAMP WITH TIME ZONE
.
-
extractPattern
public String extractPattern(TemporalUnit unit)
Obtain a pattern for the SQL equivalent to anextract()
function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.This method does not need to handle
TemporalUnit.NANOSECOND
,TemporalUnit.NATIVE
,TemporalUnit.OFFSET
,TemporalUnit.DATE
,TemporalUnit.TIME
,TemporalUnit.WEEK_OF_YEAR
, orTemporalUnit.WEEK_OF_MONTH
, which are already desugared byExtractFunction
.- Parameters:
unit
- the first argument
-
castPattern
public String castPattern(CastType from, CastType to)
Obtain a pattern for the SQL equivalent to acast()
function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.
-
trimPattern
public String trimPattern(TrimSpec specification, char character)
Obtain a pattern for the SQL equivalent to atrim()
function call. The resulting pattern must contain a ?1 placeholder for the argument of typeString
.- Parameters:
specification
-leading
ortrailing
character
- the character to trim
-
supportsFractionalTimestampArithmetic
public boolean supportsFractionalTimestampArithmetic()
Whether the database supports adding a fractional interval to a timestamp e.g. `timestamp + 0.5 second`
-
timestampdiffPattern
public String timestampdiffPattern(TemporalUnit unit, jakarta.persistence.TemporalType fromTemporalType, jakarta.persistence.TemporalType toTemporalType)
Obtain a pattern for the SQL equivalent to atimestampdiff()
function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.- Parameters:
unit
- the first argumentfromTemporalType
- true if the first argument is a timestamp, false if a datetoTemporalType
- true if the second argument is
-
timestampaddPattern
public String timestampaddPattern(TemporalUnit unit, jakarta.persistence.TemporalType temporalType, IntervalType intervalType)
Obtain a pattern for the SQL equivalent to atimestampadd()
function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.- Parameters:
unit
- The unit to add to the temporaltemporalType
- The type of the temporalintervalType
- The type of interval to add or null if it's not a native interval
-
equivalentTypes
public boolean equivalentTypes(int typeCode1, int typeCode2)
Do the given JDBC type codes, as defined inTypes
represent essentially the same type in this dialect of SQL?The default implementation treats
NUMERIC
andDECIMAL
as the same type, andFLOAT
,REAL
, andDOUBLE
as essentially the same type, since the ANSI SQL specification fails to meaningfully distinguish them.The default implementation also treats
VARCHAR
,NVARCHAR
,LONGVARCHAR
, andLONGNVARCHAR
as the same type, andBINARY
andLONGVARBINARY
as the same type, since Hibernate doesn't really differentiate these types.- Parameters:
typeCode1
- the first column type infotypeCode2
- the second column type info- Returns:
true
if the two type codes are equivalent
-
getDefaultProperties
public final Properties getDefaultProperties()
Retrieve a set of default Hibernate properties for this database.- Returns:
- a set of Hibernate properties
-
getDefaultStatementBatchSize
public int getDefaultStatementBatchSize()
The default value to use for the configuration property "hibernate.jdbc.batch_size".
-
getDefaultNonContextualLobCreation
public boolean getDefaultNonContextualLobCreation()
The default value to use for the configuration property "hibernate.jdbc.lob.non_contextual_creation".
-
getDefaultUseGetGeneratedKeys
public boolean getDefaultUseGetGeneratedKeys()
The default value to use for the configuration property "hibernate.jdbc.use_get_generated_keys".
-
contributeTypes
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Allows the Dialect to contribute additional types- Parameters:
typeContributions
- Callback to contribute the typesserviceRegistry
- The service registry
-
getLobMergeStrategy
public LobMergeStrategy getLobMergeStrategy()
-
getNativeIdentifierGeneratorStrategy
public String getNativeIdentifierGeneratorStrategy()
Resolves the native generation strategy associated to this dialect.Comes into play whenever the user specifies the native generator.
- Returns:
- The native generator strategy.
-
getIdentityColumnSupport
public IdentityColumnSupport getIdentityColumnSupport()
Get the appropriateIdentityColumnSupport
- Returns:
- the IdentityColumnSupport
- Since:
- 5.1
-
getSequenceSupport
public SequenceSupport getSequenceSupport()
-
getQuerySequencesString
public String getQuerySequencesString()
Get the select command used retrieve the names of all sequences.- Returns:
- The select command; or null if sequences are not supported.
-
getSequenceInformationExtractor
public SequenceInformationExtractor getSequenceInformationExtractor()
A source ofSequenceInformation
.
-
getSelectGUIDString
public String getSelectGUIDString()
Get the command used to select a GUID from the underlying database.Optional operation.
- Returns:
- The appropriate command.
-
supportsTemporaryTables
public boolean supportsTemporaryTables()
-
supportsTemporaryTablePrimaryKey
public boolean supportsTemporaryTablePrimaryKey()
-
getLimitHandler
public LimitHandler getLimitHandler()
Returns aLimitHandler
that implements support forQuery.setMaxResults(int)
andQuery.setFirstResult(int)
for this dialect.
-
supportsLockTimeouts
public boolean supportsLockTimeouts()
Informational metadata about whether this dialect is known to support specifying timeouts for requested lock acquisitions.- Returns:
- True is this dialect supports specifying lock timeouts.
-
isLockTimeoutParameterized
public boolean isLockTimeoutParameterized()
If this dialect supports specifying lock timeouts, are those timeouts rendered into theSQL
string as parameters. The implication is that Hibernate will need to bind the timeout value as a parameter in thePreparedStatement
. If true, the param position is always handled as the last parameter; if the dialect specifies the lock timeout elsewhere in theSQL
statement then the timeout value should be directly rendered into the statement and this method should return false.- Returns:
- True if the lock timeout is rendered into the
SQL
string as a parameter; false otherwise.
-
getLockingStrategy
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode)
Get a strategy instance which knows how to acquire a database-level lock of the specified mode for this dialect.- Parameters:
lockable
- The persister for the entity to be locked.lockMode
- The type of lock to be acquired.- Returns:
- The appropriate locking strategy.
- Since:
- 3.2
-
getForUpdateString
public String getForUpdateString(LockOptions lockOptions)
Given LockOptions (lockMode, timeout), determine the appropriate for update fragment to use.- Parameters:
lockOptions
- contains the lock mode to apply.- Returns:
- The appropriate for update fragment.
-
getForUpdateString
public String getForUpdateString(LockMode lockMode)
Given a lock mode, determine the appropriate for update fragment to use.- Parameters:
lockMode
- The lock mode to apply.- Returns:
- The appropriate for update fragment.
-
getForUpdateString
public String getForUpdateString()
Get the string to append to SELECT statements to acquire locks for this dialect.- Returns:
- The appropriate
FOR UPDATE
clause string.
-
getWriteLockString
public String getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect. Location of the returned string is treated the same as getForUpdateString.- Parameters:
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getWriteLockString
public String getWriteLockString(String aliases, int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect given the aliases of the columns to be write locked. Location of the of the returned string is treated the same as getForUpdateString.- Parameters:
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getReadLockString
public String getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire READ locks for this dialect. Location of the returned string is treated the same as getForUpdateString.- Parameters:
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getReadLockString
public String getReadLockString(String aliases, int timeout)
Get the string to append to SELECT statements to acquire READ locks for this dialect given the aliases of the columns to be read locked. Location of the returned string is treated the same as getForUpdateString.- Parameters:
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCK
clause string.
-
getWriteRowLockStrategy
public RowLockStrategy getWriteRowLockStrategy()
The row lock strategy to use for write locks.
-
getReadRowLockStrategy
public RowLockStrategy getReadRowLockStrategy()
The row lock strategy to use for read locks.
-
supportsOuterJoinForUpdate
public boolean supportsOuterJoinForUpdate()
Does this dialect supportFOR UPDATE
in conjunction with outer joined rows?- Returns:
- True if outer joined rows can be locked via
FOR UPDATE
.
-
getForUpdateString
public String getForUpdateString(String aliases)
Get theFOR UPDATE OF column_list
fragment appropriate for this dialect given the aliases of the columns to be write locked.- Parameters:
aliases
- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE OF column_list
clause string.
-
getForUpdateString
public String getForUpdateString(String aliases, LockOptions lockOptions)
Get theFOR UPDATE OF
orFOR SHARE OF
fragment appropriate for this dialect given the aliases of the columns to be locked.- Parameters:
aliases
- The columns to be locked.lockOptions
- the lock options to apply- Returns:
- The appropriate
FOR UPDATE OF column_list
clause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString()
Retrieves theFOR UPDATE NOWAIT
syntax specific to this dialect.- Returns:
- The appropriate
FOR UPDATE NOWAIT
clause string.
-
getForUpdateSkipLockedString
public String getForUpdateSkipLockedString()
Retrieves theFOR UPDATE SKIP LOCKED
syntax specific to this dialect.- Returns:
- The appropriate
FOR UPDATE SKIP LOCKED
clause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString(String aliases)
Get theFOR UPDATE OF column_list NOWAIT
fragment appropriate for this dialect given the aliases of the columns to be write locked.- Parameters:
aliases
- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE OF colunm_list NOWAIT
clause string.
-
getForUpdateSkipLockedString
public String getForUpdateSkipLockedString(String aliases)
Get theFOR UPDATE OF column_list SKIP LOCKED
fragment appropriate for this dialect given the aliases of the columns to be write locked.- Parameters:
aliases
- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE colunm_list SKIP LOCKED
clause string.
-
appendLockHint
public String appendLockHint(LockOptions lockOptions, String tableName)
Some dialects support an alternative means toSELECT FOR UPDATE
, whereby a "lock hint" is appended to the table name in the from clause.contributed by Helge Schulz
- Parameters:
lockOptions
- The lock options to applytableName
- The name of the table to which to apply the lock hint.- Returns:
- The table with any required lock hints.
-
applyLocksToSql
public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String,String[]> keyColumnNames)
Modifies the given SQL by applying the appropriate updates for the specified lock modes and key columns.The behavior here is that of an ANSI SQL
SELECT FOR UPDATE
. This method is really intended to allow dialects which do not supportSELECT FOR UPDATE
to achieve this in their own fashion.- Parameters:
sql
- the SQL string to modifyaliasedLockOptions
- lock options indexed by aliased table names.keyColumnNames
- a map of key columns indexed by aliased table names.- Returns:
- the modified SQL string.
-
getCreateTableString
public String getCreateTableString()
Command used to create a table.- Returns:
- The command used to create a table.
-
getCreateIndexString
public String getCreateIndexString(boolean unique)
-
getAlterTableString
public String getAlterTableString(String tableName)
Command used to alter a table.- Parameters:
tableName
- The name of the table to alter- Returns:
- The command used to alter a table.
- Since:
- 5.2.11
-
getAlterColumnTypeString
public String getAlterColumnTypeString(String columnName, String columnType, String columnDefinition)
-
supportsAlterColumnType
public boolean supportsAlterColumnType()
-
getCreateMultisetTableString
public String getCreateMultisetTableString()
Slight variation ongetCreateTableString()
. Here, we have the command used to create a table when there is no primary key and duplicate rows are expected.Most databases do not care about the distinction; originally added for Teradata support which does care.
- Returns:
- The command used to create a multiset table.
-
getFallbackSqmMutationStrategy
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
-
getFallbackSqmInsertStrategy
public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
-
getCreateUserDefinedTypeKindString
public String getCreateUserDefinedTypeKindString()
Command used to create a table.- Returns:
- The command used to create a table.
-
getCreateUserDefinedTypeExtensionsString
public String getCreateUserDefinedTypeExtensionsString()
-
supportsIfExistsBeforeTypeName
public boolean supportsIfExistsBeforeTypeName()
For dropping a type, can the phrase "if exists
be applied before the type name? NOTE : Only one or the other (or neither) of this andsupportsIfExistsAfterTypeName()
should return true.- Returns:
true
ifif exists
can be applied before the type name
-
supportsIfExistsAfterTypeName
public boolean supportsIfExistsAfterTypeName()
For dropping a type, can the phraseif exists
be applied after the type name? NOTE : Only one or the other (or neither) of this andsupportsIfExistsBeforeTypeName()
should return true.- Returns:
true
ifif exists
can be applied after the type name
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, int position) throws SQLException
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet
*by position*. Pre-Java 8, registering such ResultSet-returning parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.- Parameters:
statement
- The callable statement.position
- The bind position at which to register the output param.- Returns:
- The number of (contiguous) bind positions used.
- Throws:
SQLException
- Indicates problems registering the param.
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, String name) throws SQLException
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet
*by name*. Pre-Java 8, registering such ResultSet-returning parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.- Parameters:
statement
- The callable statement.name
- The parameter name (for drivers which support named parameters).- Returns:
- The number of (contiguous) bind positions used.
- Throws:
SQLException
- Indicates problems registering the param.
-
getResultSet
public ResultSet getResultSet(CallableStatement statement) throws SQLException
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
from the OUT parameter.- Parameters:
statement
- The callable statement.- Returns:
- The extracted result set.
- Throws:
SQLException
- Indicates problems extracting the result set.
-
getResultSet
public ResultSet getResultSet(CallableStatement statement, int position) throws SQLException
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
.- Parameters:
statement
- The callable statement.position
- The bind position at which to register the output param.- Returns:
- The extracted result set.
- Throws:
SQLException
- Indicates problems extracting the result set.
-
getResultSet
public ResultSet getResultSet(CallableStatement statement, String name) throws SQLException
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int)
, extract theResultSet
from the OUT parameter.- Parameters:
statement
- The callable statement.name
- The parameter name (for drivers which support named parameters).- Returns:
- The extracted result set.
- Throws:
SQLException
- Indicates problems extracting the result set.
-
supportsCurrentTimestampSelection
public boolean supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current timestamp value?- Returns:
- True if the current timestamp can be retrieved; false otherwise.
-
isCurrentTimestampSelectStringCallable
public boolean isCurrentTimestampSelectStringCallable()
Should the value returned bygetCurrentTimestampSelectString()
be treated as callable. Typically, this indicates that JDBC escape syntax is being used.- Returns:
- True if the
getCurrentTimestampSelectString()
return is callable; false otherwise.
-
getCurrentTimestampSelectString
public String getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the database.- Returns:
- The command.
-
supportsStandardCurrentTimestampFunction
public boolean supportsStandardCurrentTimestampFunction()
Does this database have an ANSI-SQLcurrent_timestamp
function?
-
buildSQLExceptionConversionDelegate
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
Build an instance of aSQLExceptionConversionDelegate
for interpreting dialect-specific error or SQLState codes.If this method is overridden to return a non-null value, the default
SQLExceptionConverter
will use the returnedSQLExceptionConversionDelegate
in addition to the following standard delegates:- a "static" delegate based on the JDBC 4 defined SQLException hierarchy;
- a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes, depending on java.sql.DatabaseMetaData#getSQLStateType
It is strongly recommended that specific Dialect implementations override this method, since interpretation of a SQL error is much more accurate when based on the vendor-specific ErrorCode rather than the SQLState.
Specific Dialects may override to return whatever is most appropriate for that vendor.
- Returns:
- The SQLExceptionConversionDelegate for this dialect
-
getViolatedConstraintNameExtractor
public ViolatedConstraintNameExtractor getViolatedConstraintNameExtractor()
- Specified by:
getViolatedConstraintNameExtractor
in interfaceConversionContext
-
getSelectClauseNullString
public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration)
Given aTypes
type code, determine an appropriate null value to use in a select clause.One thing to consider here is that certain databases might require proper casting for the nulls here since the select here will be part of a UNION/UNION ALL.
- Parameters:
sqlType
- TheTypes
type code.typeConfiguration
- The type configuration- Returns:
- The appropriate select clause value fragment.
-
supportsUnionAll
public boolean supportsUnionAll()
Does this dialect support UNION ALL.- Returns:
- True if UNION ALL is supported; false otherwise.
-
supportsUnionInSubquery
public boolean supportsUnionInSubquery()
Does this dialect support UNION in a subquery.- Returns:
- True if UNION is supported ina subquery; false otherwise.
-
getNoColumnsInsertString
@Deprecated(since="6") public String getNoColumnsInsertString()
Deprecated.Override the methodrenderInsertIntoNoColumns()
on thetranslator
returned by this dialectThe fragment used to insert a row without specifying any column values. This is not possible on some databases.- Returns:
- The appropriate empty values clause.
-
supportsNoColumnsInsert
public boolean supportsNoColumnsInsert()
Check if the INSERT statement is allowed to contain no column.- Returns:
- if the Dialect supports no-column INSERT.
-
getLowercaseFunction
public String getLowercaseFunction()
The name of the SQL function that transforms a string to lowercase- Returns:
- The dialect-specific lowercase function.
-
getCaseInsensitiveLike
public String getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive like comparison.- Returns:
- The dialect-specific "case insensitive" like function.
-
supportsCaseInsensitiveLike
public boolean supportsCaseInsensitiveLike()
Does this dialect support case insensitive LIKE restrictions?- Returns:
true
if the underlying database supports case insensitive like comparison,false
otherwise. The default isfalse
.
-
supportsTruncateWithCast
public boolean supportsTruncateWithCast()
Does this dialect support truncation of values to a specified length through a cast?- Returns:
true
if the underlying database supports truncation through a cast,false
otherwise. The default istrue
.
-
transformSelectString
public String transformSelectString(String select)
Meant as a means for end users to affect the select strings being sent to the database and perhaps manipulate them in some fashion.- Parameters:
select
- The select command- Returns:
- The mutated select command, or the same as was passed in.
-
getMaxAliasLength
public int getMaxAliasLength()
What is the maximum length Hibernate can use for generated aliases?The maximum here should account for the fact that Hibernate often needs to append "uniqueing" information to the end of generated aliases. That "uniqueing" information will be added to the end of a identifier generated to the length specified here; so be sure to leave some room (generally speaking 5 positions will suffice).
- Returns:
- The maximum length.
-
getMaxIdentifierLength
public int getMaxIdentifierLength()
What is the maximum identifier length supported by the dialect?- Returns:
- The maximum length.
-
toBooleanValueString
public String toBooleanValueString(boolean bool)
The SQL literal value to which this database maps boolean values.- Parameters:
bool
- The boolean value- Returns:
- The appropriate SQL literal.
-
appendBooleanValueString
public void appendBooleanValueString(SqlAppender appender, boolean bool)
-
registerKeyword
protected void registerKeyword(String word)
-
buildIdentifierHelper
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException
Build the IdentifierHelper indicated by this Dialect for handling identifier conversions. Returningnull
is allowed and indicates that Hibernate should fallback 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
- Parameters:
builder
- A semi-configured IdentifierHelper builder.dbMetaData
- Access to the metadata returned from the driver if needed and if available. WARNING: may benull
- Returns:
- The IdentifierHelper instance to use, or
null
to indicate Hibernate should use its fallback path - Throws:
SQLException
- Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.- See Also:
getNameQualifierSupport()
-
openQuote
public char openQuote()
The character specific to this dialect used to begin a quoted identifier.- Returns:
- The dialect's specific open quote character.
-
closeQuote
public char closeQuote()
The character specific to this dialect used to close a quoted identifier.- Returns:
- The dialect's specific close quote character.
-
toQuotedIdentifier
public String toQuotedIdentifier(String name)
Apply dialect-specific quoting.- Parameters:
name
- The value to be quoted.- Returns:
- The quoted value.
- See Also:
openQuote()
,closeQuote()
-
quote
public final String quote(String name)
Apply dialect-specific quoting.By default, the incoming value is checked to see if its first character is the back-tick (`). If so, the dialect specific quoting is applied.
- Parameters:
name
- The value to be quoted.- Returns:
- The quoted (or unmodified, if not starting with back-tick) value.
- See Also:
openQuote()
,closeQuote()
-
getTableMigrator
public TableMigrator getTableMigrator()
-
getTableCleaner
public Cleaner getTableCleaner()
-
getUserDefinedTypeExporter
public Exporter<UserDefinedType> getUserDefinedTypeExporter()
-
getForeignKeyExporter
public Exporter<ForeignKey> getForeignKeyExporter()
-
getUniqueKeyExporter
public Exporter<Constraint> getUniqueKeyExporter()
-
getAuxiliaryDatabaseObjectExporter
public Exporter<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectExporter()
-
getTemporaryTableExporter
public TemporaryTableExporter getTemporaryTableExporter()
-
getSupportedTemporaryTableKind
public TemporaryTableKind getSupportedTemporaryTableKind()
-
getTemporaryTableCreateOptions
public String getTemporaryTableCreateOptions()
-
getTemporaryTableCreateCommand
public String getTemporaryTableCreateCommand()
-
getTemporaryTableDropCommand
public String getTemporaryTableDropCommand()
-
getTemporaryTableTruncateCommand
public String getTemporaryTableTruncateCommand()
-
getCreateTemporaryTableColumnAnnotation
public String getCreateTemporaryTableColumnAnnotation(int sqlTypeCode)
Annotation to be appended to the end of each COLUMN clause for temporary tables.- Parameters:
sqlTypeCode
- The SQL type code- Returns:
- The annotation to be appended (e.g. "COLLATE DATABASE_DEFAULT" in SQLServer SQL)
-
getTemporaryTableDdlTransactionHandling
public TempTableDdlTransactionHandling getTemporaryTableDdlTransactionHandling()
-
getTemporaryTableAfterUseAction
public AfterUseAction getTemporaryTableAfterUseAction()
-
getTemporaryTableBeforeUseAction
public BeforeUseAction getTemporaryTableBeforeUseAction()
-
canCreateCatalog
public boolean canCreateCatalog()
Does this dialect support catalog creation?- Returns:
- True if the dialect supports catalog creation; false otherwise.
-
getCreateCatalogCommand
public String[] getCreateCatalogCommand(String catalogName)
Get the SQL command used to create the named catalog- Parameters:
catalogName
- The name of the catalog to be created.- Returns:
- The creation commands
-
getDropCatalogCommand
public String[] getDropCatalogCommand(String catalogName)
Get the SQL command used to drop the named catalog- Parameters:
catalogName
- The name of the catalog to be dropped.- Returns:
- The drop commands
-
canCreateSchema
public boolean canCreateSchema()
Does this dialect support schema creation?- Returns:
- True if the dialect supports schema creation; false otherwise.
-
getCreateSchemaCommand
public String[] getCreateSchemaCommand(String schemaName)
Get the SQL command used to create the named schema- Parameters:
schemaName
- The name of the schema to be created.- Returns:
- The creation commands
-
getDropSchemaCommand
public String[] getDropSchemaCommand(String schemaName)
Get the SQL command used to drop the named schema- Parameters:
schemaName
- The name of the schema to be dropped.- Returns:
- The drop commands
-
getCurrentSchemaCommand
public String getCurrentSchemaCommand()
Get the SQL command used to retrieve the current schema name. Works in conjunction withgetSchemaNameResolver()
, unless the return from there does not need this information. E.g., a custom impl might make use of the Java 1.7 addition of theConnection.getSchema()
method- Returns:
- The current schema retrieval SQL
-
getSchemaNameResolver
public SchemaNameResolver getSchemaNameResolver()
Get the strategy for determining the schema name of a Connection- Returns:
- The schema name resolver strategy
-
hasAlterTable
public boolean hasAlterTable()
Does this dialect support theALTER TABLE
syntax?- Returns:
- True if we support altering of tables; false otherwise.
-
dropConstraints
public boolean dropConstraints()
Do we need to drop constraints before dropping tables in this dialect?- Returns:
- True if constraints must be dropped prior to dropping the table; false otherwise.
-
qualifyIndexName
public boolean qualifyIndexName()
Do we need to qualify index names with the schema name?- Returns:
- boolean
-
getAddColumnString
public String getAddColumnString()
The syntax used to add a column to a table (optional).- Returns:
- The "add column" fragment.
-
getAddColumnSuffixString
public String getAddColumnSuffixString()
The syntax for the suffix used to add a column to a table (optional).- Returns:
- The suffix "add column" fragment.
-
getDropForeignKeyString
public String getDropForeignKeyString()
Thealter table
subcommand used to drop a foreign key constraint.
-
getDropUniqueKeyString
public String getDropUniqueKeyString()
Thealter table
subcommand used to drop a unique key constraint.
-
getTableTypeString
public String getTableTypeString()
-
getAddForeignKeyConstraintString
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table.- Parameters:
constraintName
- The FK constraint name.foreignKey
- The names of the columns comprising the FKreferencedTable
- The table referenced by the FKprimaryKey
- The explicit columns in the referencedTable referenced by this FK.referencesPrimaryKey
- if false, constraint should be explicit about which column names the constraint refers to- Returns:
- the "add FK" fragment
-
getAddForeignKeyConstraintString
public String getAddForeignKeyConstraintString(String constraintName, String foreignKeyDefinition)
-
getAddPrimaryKeyConstraintString
public String getAddPrimaryKeyConstraintString(String constraintName)
The syntax used to add a primary key constraint to a table.- Parameters:
constraintName
- The name of the PK constraint.- Returns:
- The "add PK" fragment
-
hasSelfReferentialForeignKeyBug
public boolean hasSelfReferentialForeignKeyBug()
Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?- Returns:
true
if the database/driver has this bug
-
getNullColumnString
public String getNullColumnString()
The keyword used to specify a nullable column.- Returns:
- String
-
getNullColumnString
public String getNullColumnString(String columnType)
The keyword used to specify a nullable column.- Returns:
- String
-
supportsCommentOn
public boolean supportsCommentOn()
Does this dialect support commenting on tables and columns?- Returns:
true
if commenting is supported
-
getTableComment
public String getTableComment(String comment)
Get the comment into a form supported for table definition.- Parameters:
comment
- The comment to apply- Returns:
- The comment fragment
-
getUserDefinedTypeComment
public String getUserDefinedTypeComment(String comment)
Get the comment into a form supported for UDT definition.- Parameters:
comment
- The comment to apply- Returns:
- The comment fragment
-
getColumnComment
public String getColumnComment(String comment)
Get the comment into a form supported for column definition.- Parameters:
comment
- The comment to apply- Returns:
- The comment fragment
-
supportsIfExistsBeforeTableName
public boolean supportsIfExistsBeforeTableName()
For dropping a table, can the phrase "if exists
be applied before the table name?NOTE : Only one or the other (or neither) of this and
supportsIfExistsAfterTableName()
should return true.- Returns:
true
ifif exists
can be applied before the table name
-
supportsIfExistsAfterTableName
public boolean supportsIfExistsAfterTableName()
For dropping a table, can the phraseif exists
be applied after the table name?NOTE : Only one or the other (or neither) of this and
supportsIfExistsBeforeTableName()
should return true.- Returns:
true
ifif exists
can be applied after the table name
-
supportsIfExistsBeforeConstraintName
public boolean supportsIfExistsBeforeConstraintName()
For dropping a constraint with analter table
statement, can the phraseif exists
be applied before the constraint name?NOTE : Only one or the other (or neither) of this and
supportsIfExistsAfterConstraintName()
should return true- Returns:
true
ifif exists
can be applied before the constraint name
-
supportsIfExistsAfterConstraintName
public boolean supportsIfExistsAfterConstraintName()
For dropping a constraint with analter table
, can the phraseif exists
be applied after the constraint name?NOTE : Only one or the other (or neither) of this and
supportsIfExistsBeforeConstraintName()
should return true.- Returns:
true
ifif exists
can be applied after the constraint name
-
supportsIfExistsAfterAlterTable
public boolean supportsIfExistsAfterAlterTable()
For analter table
, can the phrase "if exists
be applied?- Returns:
true
ifif exists
can be applied afteralter table
- Since:
- 5.2.11
-
getDropTableString
public String getDropTableString(String tableName)
Generate aDROP TABLE
statement- Parameters:
tableName
- The name of the table to drop- Returns:
- The
DROP TABLE
statement as a string
-
supportsColumnCheck
public boolean supportsColumnCheck()
Does this dialect support column-level check constraints?- Returns:
- True if column-level
check
constraints are supported; false otherwise.
-
supportsTableCheck
public boolean supportsTableCheck()
Does this dialect support table-level check constraints?- Returns:
- True if table-level
check
constraints are supported; false otherwise.
-
supportsCascadeDelete
public boolean supportsCascadeDelete()
Does this dialect supporton delete
actions in foreign key definitions?- Returns:
true
if the dialect does support theon delete
clause.
-
getCascadeConstraintsString
public String getCascadeConstraintsString()
The keyword that specifies that adrop table
operation should be cascaded to its constraints, typically" cascade"
where the leading space is required, or the empty string if there is no such keyword in this dialect.- Returns:
- The cascade drop keyword, if any, with a leading space
-
getColumnAliasExtractor
public ColumnAliasExtractor getColumnAliasExtractor()
-
useInputStreamToInsertBlob
public boolean useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations, that is, usingPreparedStatement.setBinaryStream(int, java.io.InputStream, int)
).- Returns:
- True if BLOBs and CLOBs should be bound using stream operations.
- Since:
- 3.2
-
supportsParametersInInsertSelect
public boolean supportsParametersInInsertSelect()
Does this dialect support parameters within theSELECT
clause ofINSERT ... SELECT ...
statements?- Returns:
- True if this is supported; false otherwise.
- Since:
- 3.2
-
supportsOrdinalSelectItemReference
public boolean supportsOrdinalSelectItemReference()
Does this dialect support references to result variables (i.e, select items) by column positions (1-origin) as defined by the select clause?- Returns:
- true if result variable references by column positions are supported; false otherwise.
- Since:
- 6.0.0
-
getNullOrdering
public NullOrdering getNullOrdering()
Returns the ordering of null.- Since:
- 6.0.0
-
supportsNullPrecedence
public boolean supportsNullPrecedence()
-
isAnsiNullOn
public boolean isAnsiNullOn()
-
requiresCastForConcatenatingNonStrings
public boolean requiresCastForConcatenatingNonStrings()
Does this dialect/database require casting of non-string arguments in a concat function?- Returns:
true
if casting of non-string arguments in concat is required- Since:
- 6.2
-
requiresFloatCastingOfIntegerDivision
public boolean requiresFloatCastingOfIntegerDivision()
Does this dialect require that integer divisions be wrapped incast()
calls to tell the db parser the expected type.- Returns:
- True if integer divisions must be cast()ed to float
-
supportsResultSetPositionQueryMethodsOnForwardOnlyCursor
public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor()
Does this dialect support asking the result set its positioning information on forward only cursors. Specifically, in the case of scrolling fetches, Hibernate needs to useResultSet.isAfterLast()
andResultSet.isBeforeFirst()
. Certain drivers do not allow access to these methods for forward only cursors.NOTE : this is highly driver dependent!
- Returns:
- True if methods like
ResultSet.isAfterLast()
andResultSet.isBeforeFirst()
are supported for forward only cursors; false otherwise. - Since:
- 3.2
-
supportsCircularCascadeDeleteConstraints
public boolean supportsCircularCascadeDeleteConstraints()
Does this dialect support definition of cascade delete constraints which can cause circular chains?- Returns:
- True if circular cascade delete constraints are supported; false otherwise.
- Since:
- 3.2
-
supportsSubselectAsInPredicateLHS
public boolean supportsSubselectAsInPredicateLHS()
Are subselects supported as the left-hand-side (LHS) of IN-predicates.In other words, is syntax like
... <subquery> IN (1, 2, 3) ...
supported?- Returns:
- True if subselects can appear as the LHS of an in-predicate; false otherwise.
- Since:
- 3.2
-
supportsExpectedLobUsagePattern
public boolean supportsExpectedLobUsagePattern()
Expected LOB usage pattern is such that I can perform an insert via prepared statement with a parameter binding for a LOB value without crazy casting to JDBC driver implementation-specific classes...Part of the trickiness here is the fact that this is largely driver dependent. For example, Oracle (which is notoriously bad with LOB support in their drivers historically) actually does a pretty good job with LOB support as of the 10.2.x versions of their drivers...
- Returns:
- True if normal LOB usage patterns can be used with this driver; false if driver-specific hookiness needs to be applied.
- Since:
- 3.2
-
supportsLobValueChangePropagation
public boolean supportsLobValueChangePropagation()
Does the dialect support propagating changes to LOB values back to the database? Talking about mutating the internal value of the locator as opposed to supplying a new locator instance...For BLOBs, the internal value might be changed by:
Blob.setBinaryStream(long)
,Blob.setBytes(long, byte[])
,Blob.setBytes(long, byte[], int, int)
, orBlob.truncate(long)
.For CLOBs, the internal value might be changed by:
Clob.setAsciiStream(long)
,Clob.setCharacterStream(long)
,Clob.setString(long, String)
,Clob.setString(long, String, int, int)
, orClob.truncate(long)
.NOTE : I do not know the correct answer currently for databases which (1) are not part of the cruise control process or (2) do not
supportsExpectedLobUsagePattern()
.- Returns:
- True if the changes are propagated back to the database; false otherwise.
- Since:
- 3.2
-
supportsUnboundedLobLocatorMaterialization
public boolean supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in which it was created?Again, part of the trickiness here is the fact that this is largely driver dependent.
NOTE: all database I have tested which
supportsExpectedLobUsagePattern()
also support the ability to materialize a LOB outside the owning transaction...- Returns:
- True if unbounded materialization is supported; false otherwise.
- Since:
- 3.2
-
supportsSubqueryOnMutatingTable
public boolean supportsSubqueryOnMutatingTable()
Does this dialect support referencing the table being mutated in a subquery? The "table being mutated" is the table referenced in an update or delete query. And so can that table then be referenced in a subquery of the update or delete query?For example, would the following two syntaxes be supported:
delete from TABLE_A where ID not in (select ID from TABLE_A)
update TABLE_A set NON_ID = 'something' where ID in (select ID from TABLE_A)
- Returns:
- True if this dialect allows references the mutating table from a subquery.
-
supportsExistsInSelect
public boolean supportsExistsInSelect()
Does the dialect support an exists statement in the select clause?- Returns:
- True if exists checks are allowed in the select clause; false otherwise.
-
doesReadCommittedCauseWritersToBlockReaders
public boolean doesReadCommittedCauseWritersToBlockReaders()
For the underlying database, isREAD_COMMITTED
isolation implemented by forcing readers to wait for write locks to be released?- Returns:
- True if writers block readers to achieve
READ_COMMITTED
; false otherwise.
-
doesRepeatableReadCauseReadersToBlockWriters
public boolean doesRepeatableReadCauseReadersToBlockWriters()
For the underlying database, isREPEATABLE_READ
isolation implemented by forcing writers to wait for read locks to be released?- Returns:
- True if readers block writers to achieve
REPEATABLE_READ
; false otherwise.
-
supportsBindAsCallableArgument
public boolean supportsBindAsCallableArgument()
Does this dialect support using a JDBC bind parameter as an argument to a function or procedure call?- Returns:
- Returns
true
if the database supports accepting bind params as args,false
otherwise. The default istrue
.
-
supportsTupleCounts
public boolean supportsTupleCounts()
Does this dialect supportcount(a,b)
?- Returns:
- True if the database supports counting tuples; false otherwise.
-
requiresParensForTupleCounts
public boolean requiresParensForTupleCounts()
IfsupportsTupleCounts()
is true, does this dialect require the tuple to be delimited with parens?- Returns:
- boolean
-
supportsTupleDistinctCounts
public boolean supportsTupleDistinctCounts()
Does this dialect supportcount(distinct a,b)
?- Returns:
- True if the database supports counting distinct tuples; false otherwise.
-
requiresParensForTupleDistinctCounts
public boolean requiresParensForTupleDistinctCounts()
IfsupportsTupleDistinctCounts()
is true, does this dialect require the tuple to be delimited with parens?- Returns:
- boolean
-
getInExpressionCountLimit
public int getInExpressionCountLimit()
Return the limit that the underlying database places on the number of elements in anIN
predicate. If the database defines no such limits, simply return zero or less-than-zero.- Returns:
- int The limit, or zero-or-less to indicate no limit.
-
forceLobAsLastValue
public boolean forceLobAsLastValue()
HHH-4635 Oracle expects all Lob values to be last in inserts and updates.- Returns:
- boolean True if Lob values should be last, false if it does not matter.
-
isEmptyStringTreatedAsNull
public boolean isEmptyStringTreatedAsNull()
Return whether the dialect considers an empty-string value as null.- Returns:
- boolean True if an empty string is treated as null, false otherwise.
-
useFollowOnLocking
public boolean useFollowOnLocking(String sql, QueryOptions queryOptions)
Some dialects have trouble applying pessimistic locking depending upon what other query options are specified (paging, ordering, etc). This method allows these dialects to request that locking be applied by subsequent selects.- Returns:
true
indicates that the dialect requests that locking be applied by subsequent select;false
(the default) indicates that locking should be applied to the main SQL statement.- Since:
- 5.2
-
getUniqueDelegate
public UniqueDelegate getUniqueDelegate()
Get theUniqueDelegate
supported by this dialect- Returns:
- The UniqueDelegate
-
getQueryHintString
public String getQueryHintString(String query, List<String> hintList)
Apply a hint to the 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.
- Parameters:
query
- The query to which to apply the hint.hintList
- The hints to apply- Returns:
- The modified SQL
-
getQueryHintString
public String getQueryHintString(String query, String hints)
Apply a hint to the 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.
- Parameters:
query
- The query to which to apply the hint.hints
- The hints to apply- Returns:
- The modified SQL
-
defaultScrollMode
public ScrollMode defaultScrollMode()
Certain dialects support a subset ofScrollMode
s. Provide a default to be used by Criteria and Query.- Returns:
- the default
ScrollMode
to use.
-
supportsOffsetInSubquery
public boolean supportsOffsetInSubquery()
Does this dialect supportoffset
in subqueries? For example:select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1 offset 1)
- Returns:
true
if it does
-
supportsOrderByInSubquery
public boolean supportsOrderByInSubquery()
Does this dialect support theorder by
clause in subqueries? For example:select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1)
- Returns:
true
if it does
-
supportsSubqueryInSelect
public boolean supportsSubqueryInSelect()
Does this dialect support subqueries in theselect
clause? For example:select col1, (select col2 from Table2 where ...) from Table1
- Returns:
true
if it does
-
supportsInsertReturning
public boolean supportsInsertReturning()
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 ... )
- Returns:
true
ifInsertReturningDelegate
works for any sort of primary key column (not just identity columns), orfalse
ifInsertReturningDelegate
does not work, or only works for specialized identity/"autoincrement" columns- Since:
- 6.2
- See Also:
OnExecutionGenerator.getGeneratedIdentifierDelegate(org.hibernate.id.PostInsertIdentityPersister)
,InsertReturningDelegate
-
supportsInsertReturningGeneratedKeys
public boolean supportsInsertReturningGeneratedKeys()
Does this dialect fully support returning arbitrary generated column values after execution of aninsert
statement, using the JDBC methodConnection.prepareStatement(String, String[])
.Support for returning the generated value of an identity column via the JDBC method
Connection.prepareStatement(String, int)
is insufficient here.- Returns:
true
ifGetGeneratedKeysDelegate
works for any sort of primary key column (not just identity columns), orfalse
ifGetGeneratedKeysDelegate
does not work, or only works for specialized identity/"autoincrement" columns- Since:
- 6.2
- See Also:
OnExecutionGenerator.getGeneratedIdentifierDelegate(org.hibernate.id.PostInsertIdentityPersister)
,GetGeneratedKeysDelegate
-
supportsFetchClause
public boolean supportsFetchClause(FetchClauseType type)
Does this dialect support the given fetch clause type.- Parameters:
type
- The fetch clause type- Returns:
true
if the underlying database supports the given fetch clause type,false
otherwise. The default isfalse
.
-
supportsWindowFunctions
public boolean supportsWindowFunctions()
Does this dialect support window functions likerow_number() over (..)
?- Returns:
true
if the underlying database supports window functions,false
otherwise. The default isfalse
.
-
supportsLateral
public boolean supportsLateral()
Does this dialect support the SQLlateral
keyword or a proprietary alternative?- Returns:
true
if the underlying database supports lateral,false
otherwise. The default isfalse
.
-
getCallableStatementSupport
public CallableStatementSupport getCallableStatementSupport()
-
getNameQualifierSupport
public NameQualifierSupport getNameQualifierSupport()
By default interpret this based on DatabaseMetaData.- Returns:
- The NameQualifierSupport.
-
getDefaultBatchLoadSizingStrategy
public BatchLoadSizingStrategy getDefaultBatchLoadSizingStrategy()
-
isJdbcLogWarningsEnabledByDefault
public boolean isJdbcLogWarningsEnabledByDefault()
Is JDBC statement warning logging enabled by default?- Since:
- 5.1
-
supportsPartitionBy
public boolean supportsPartitionBy()
Does the underlying database support partition by?- Since:
- 5.2
-
supportsNamedParameters
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData) throws SQLException
Override the DatabaseMetaData#supportsNamedParameters()- Returns:
- boolean
- Throws:
SQLException
- Accessing the DatabaseMetaData can throw it. Just rethrow and Hibernate will handle.
-
getNationalizationSupport
public NationalizationSupport getNationalizationSupport()
Determines whether this database requires the use of explicit nationalized character data types.That is, whether the use of
Types.NCHAR
,Types.NVARCHAR
, andTypes.NCLOB
is required for nationalized character data (Unicode).
-
getAggregateSupport
public AggregateSupport getAggregateSupport()
How the Dialect supports aggregate types likeSqlTypes.STRUCT
.- Since:
- 6.2
-
supportsStandardArrays
public boolean supportsStandardArrays()
Database has native support for SQL standard arrays which can be referred to by its base type name.Oracle doesn't allow this, but instead has support for named arrays.
- Returns:
- boolean
- Since:
- 6.1
-
getArrayTypeName
public String getArrayTypeName(String elementTypeName)
The SQL type name for the array of the given type name.- Since:
- 6.1
-
appendArrayLiteral
public void appendArrayLiteral(SqlAppender appender, Object[] literal, JdbcLiteralFormatter<Object> elementFormatter, WrapperOptions wrapperOptions)
-
supportsDistinctFromPredicate
public boolean supportsDistinctFromPredicate()
Does this dialect support some kind ofdistinct from
predicate?This is, does it support syntax like
... where FIRST_NAME IS DISTINCT FROM LAST_NAME
?- Returns:
- True if this SQL dialect is known to support some kind of distinct from predicate; false otherwise
- Since:
- 6.1
-
getPreferredSqlTypeCodeForArray
public int getPreferredSqlTypeCodeForArray()
The JDBCtype code
to use for mapping properties of basic Java array orCollection
types.Usually
SqlTypes.ARRAY
orSqlTypes.VARBINARY
.- Returns:
- one of the type codes defined by
SqlTypes
. - Since:
- 6.1
-
getPreferredSqlTypeCodeForBoolean
public int getPreferredSqlTypeCodeForBoolean()
The JDBCtype code
to use for mapping properties of Java typeboolean
.Usually
Types.BOOLEAN
orTypes.BIT
.- Returns:
- one of the type codes defined by
Types
.
-
supportsNonQueryWithCTE
public boolean supportsNonQueryWithCTE()
Does this dialect support insert, update, and delete statements with Common Table Expressions?- Returns:
true
if non-query statements are supported with CTE
-
supportsRecursiveCTE
public boolean supportsRecursiveCTE()
Does this dialect/database support recursive CTEs (Common Table Expressions)?- Returns:
true
if recursive CTEs are supported- Since:
- 6.2
-
supportsValuesList
public boolean supportsValuesList()
Does this dialect supportvalues
lists of formVALUES (1), (2), (3)
?- Returns:
true
ifvalues
list are supported
-
supportsValuesListForInsert
public boolean supportsValuesListForInsert()
Does this dialect supportvalues
lists of formVALUES (1), (2), (3)
in insert statements?- Returns:
true
ifvalues
list are supported in insert statements
-
supportsSkipLocked
public boolean supportsSkipLocked()
Does this dialect supportSKIP_LOCKED
timeout.- Returns:
true
if SKIP_LOCKED is supported
-
supportsNoWait
public boolean supportsNoWait()
Does this dialect supportNO_WAIT
timeout.- Returns:
true
ifNO_WAIT
is supported
-
supportsWait
public boolean supportsWait()
Does this dialect supportWAIT
timeout.- Returns:
true
ifWAIT
is supported
-
inlineLiteral
public String inlineLiteral(String literal)
Inline String literal.- Returns:
- escaped String
-
appendLiteral
public void appendLiteral(SqlAppender appender, String literal)
-
supportsJdbcConnectionLobCreation
public boolean supportsJdbcConnectionLobCreation(DatabaseMetaData databaseMetaData)
Check whether the JDBCConnection
supports creating LOBs viaConnection.createBlob()
,Connection.createNClob()
, orConnection.createClob()
.- Parameters:
databaseMetaData
- JDBCDatabaseMetaData
which can be used if LOB creation is supported only starting from a given driver version- Returns:
true
if LOBs can be created via the JDBC Connection.
-
supportsMaterializedLobAccess
public boolean supportsMaterializedLobAccess()
Check whether the JDBC driver allows setting LOBs viaPreparedStatement.setBytes(int, byte[])
,PreparedStatement.setNString(int, String)
orPreparedStatement.setString(int, String)
APIs.- Returns:
true
if LOBs can be set with the materialized APIs.- Since:
- 6.2
-
useMaterializedLobWhenCapacityExceeded
public boolean useMaterializedLobWhenCapacityExceeded()
Whether to switch fromVARCHAR
-like types toSqlTypes.MATERIALIZED_CLOB
,NVARCHAR
-like types toSqlTypes.MATERIALIZED_NCLOB
andVARBINARY
-like types toSqlTypes.MATERIALIZED_BLOB
types, when the requested size for a type exceeds thegetMaxVarcharCapacity()
,getMaxNVarcharCapacity()
andgetMaxVarbinaryCapacity()
respectively.- Returns:
true
if materialized LOBs should be used for capacity exceeding types.- Since:
- 6.2
-
addSqlHintOrComment
public String addSqlHintOrComment(String sql, QueryOptions queryOptions, boolean commentsEnabled)
Modify the SQL, adding hints or comments, if necessary
-
getHqlTranslator
public HqlTranslator getHqlTranslator()
Return anHqlTranslator
specific to this dialect. Returnnull
to use Hibernate's standard translator.Note that
QueryEngineOptions.getCustomHqlTranslator()
has higher precedence since it comes directly from the user config
-
getSqmTranslatorFactory
public SqmTranslatorFactory getSqmTranslatorFactory()
Return aSqmTranslatorFactory
specific to this dialect. Returnnull
to use Hibernate's standard translator.Note that
QueryEngineOptions.getCustomSqmTranslatorFactory()
has higher precedence since it comes directly from the user config
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Return aSqlAstTranslatorFactory
specific to this dialect. Returnnull
to use Hibernate's standard translator.
-
getGroupBySelectItemReferenceStrategy
public SelectItemReferenceStrategy getGroupBySelectItemReferenceStrategy()
-
getSizeStrategy
public Dialect.SizeStrategy getSizeStrategy()
-
getMaxVarcharLength
public int getMaxVarcharLength()
The biggest size value that can be supplied as argument to aTypes.VARCHAR
-like type. For longer column lengths, use some sort oftext
-like type for the column.
-
getMaxNVarcharLength
public int getMaxNVarcharLength()
The biggest size value that can be supplied as argument to aTypes.NVARCHAR
-like type. For longer column lengths, use some sort ofntext
-like type for the column.
-
getMaxVarbinaryLength
public int getMaxVarbinaryLength()
The biggest size value that can be supplied as argument to aTypes.VARBINARY
-like type. For longer column lengths, use some sort ofimage
-like type for the column.
-
getMaxVarcharCapacity
public int getMaxVarcharCapacity()
The longest possible length of aTypes.VARCHAR
-like column. For longer column lengths, use some sort ofclob
-like type for the column.
-
getMaxNVarcharCapacity
public int getMaxNVarcharCapacity()
The longest possible length of aTypes.NVARCHAR
-like column. For longer column lengths, use some sort ofnclob
-like type for the column.
-
getMaxVarbinaryCapacity
public int getMaxVarbinaryCapacity()
The longest possible length of aTypes.VARBINARY
-like column. For longer column lengths, use some sort ofblob
-like type for the column.
-
getDefaultLobLength
public long getDefaultLobLength()
-
getDefaultDecimalPrecision
public int getDefaultDecimalPrecision()
This is the default precision for a generated column mapped to aBigInteger
orBigDecimal
.Usually returns the maximum precision of the database, except when there is no such maximum precision, or the maximum precision is very high.
- Returns:
- the default precision, in decimal digits
-
getDefaultTimestampPrecision
public int getDefaultTimestampPrecision()
This is the default precision for a generated column mapped to aTimestamp
orLocalDateTime
.Usually 6 (microseconds) or 3 (milliseconds).
- Returns:
- the default precision, in decimal digits, of the fractional seconds field
-
getFloatPrecision
public int getFloatPrecision()
This is the default precision for a generated column mapped to a JavaFloat
orfloat
. That is, a value representing "single precision".Usually 24 binary digits, at least for databases with a conventional interpretation of the ANSI SQL specification.
- Returns:
- a value representing "single precision", usually in binary digits, but sometimes in decimal digits
-
getDoublePrecision
public int getDoublePrecision()
This is the default precision for a generated column mapped to a JavaDouble
ordouble
. That is, a value representing "double precision".Usually 53 binary digits, at least for databases with a conventional interpretation of the ANSI SQL specification.
- Returns:
- a value representing "double precision", usually in binary digits, but sometimes in decimal digits
-
getFractionalSecondPrecisionInNanos
public long getFractionalSecondPrecisionInNanos()
The "native" precision for arithmetic with datetimes and day-to-second durations. Datetime differences will be calculated with this precision except when a precision is explicitly specified as aTemporalUnit
.Usually 1 (nanoseconds), 1_000 (microseconds), or 1_000_000 (milliseconds).
- Returns:
- the precision, specified as a quantity of nanoseconds
- See Also:
TemporalUnit.NATIVE
-
supportsBitType
public boolean supportsBitType()
Does this dialect have a true SQLBIT
type with just two values (0 and 1) or, even better, a proper SQLBOOLEAN
type, or doesTypes.BIT
get mapped to a numeric type with more than two values?- Returns:
- true if there is a
BIT
orBOOLEAN
type
-
supportsPredicateAsExpression
protected boolean supportsPredicateAsExpression()
Whether a predicate like `a > 0` can appear in an expression context e.g. a select item list.
-
appendBinaryLiteral
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes)
-
getLockRowIdentifier
public RowLockStrategy getLockRowIdentifier(LockMode lockMode)
-
generatedAs
public String generatedAs(String generatedAs)
Thegenerated as
clause, or similar, for generated column declarations in DDL statements.- Parameters:
generatedAs
- a SQL expression used to generate the column value- Returns:
- The
generated as
clause containing the given expression
-
hasDataTypeBeforeGeneratedAs
public boolean hasDataTypeBeforeGeneratedAs()
Is an explicit column type required forgenerated as
columns?- Returns:
true
if an explicit type is required
-
createUpsertOperation
public MutationOperation createUpsertOperation(EntityMutationTarget mutationTarget, TableUpsert tableUpsert, SessionFactoryImplementor factory)
-
canDisableConstraints
public boolean canDisableConstraints()
Is there some way to disable foreign key constraint checking while truncating tables? (If there's no way to do it, and if we can't batch truncate, we must drop and recreate the constraints instead.)- Returns:
true
if there is some way to do it- See Also:
getDisableConstraintsStatement()
,getDisableConstraintStatement(String, String)
-
getDisableConstraintsStatement
public String getDisableConstraintsStatement()
A SQL statement that temporarily disables foreign key constraint checking for all tables.
-
getEnableConstraintsStatement
public String getEnableConstraintsStatement()
A SQL statement that re-enables foreign key constraint checking for all tables.
-
getDisableConstraintStatement
public String getDisableConstraintStatement(String tableName, String name)
A SQL statement that temporarily disables checking of the given foreign key constraint.- Parameters:
tableName
- the name of the tablename
- the name of the constraint
-
getEnableConstraintStatement
public String getEnableConstraintStatement(String tableName, String name)
A SQL statement that re-enables checking of the given foreign key constraint.- Parameters:
tableName
- the name of the tablename
- the name of the constraint
-
canBatchTruncate
public boolean canBatchTruncate()
Does thetruncate table
statement accept multiple tables?- Returns:
true
if it does
-
getTruncateTableStatements
public String[] getTruncateTableStatements(String[] tableNames)
A SQL statement or statements that truncate the given tables.- Parameters:
tableNames
- the names of the tables
-
getTruncateTableStatement
public String getTruncateTableStatement(String tableName)
A SQL statement that truncates the given table.- Parameters:
tableName
- the name of the table
-
appendDatetimeFormat
public void appendDatetimeFormat(SqlAppender appender, String format)
Translate the given datetime format string from the pattern language defined by Java'sDateTimeFormatter
to whatever pattern language is understood by the native datetime formatting function for this database (often theto_char()
function).Since it's never possible to translate every pattern letter sequences understood by
DateTimeFormatter
, only the following subset of pattern letters is accepted by Hibernate:- G: era
- y: year of era
- Y: year of week-based year
- M: month of year
- w: week of week-based year (ISO week number)
- W: week of month
- E: day of week (name)
- e: day of week (number)
- d: day of month
- D: day of year
- a: AM/PM
- H: hour of day (24 hour time)
- h: hour of AM/PM (12 hour time)
- m: minutes
- s: seconds
- z,Z,x: timezone offset
Appends a pattern accepted by the function that formats dates and times in this dialect to a SQL fragment that is being constructed.
-
translateExtractField
public String translateExtractField(TemporalUnit unit)
Return the name used to identify the given field as an argument to theextract()
function, or of this dialect's equivalent function.This method does not need to handle
TemporalUnit.NANOSECOND
,TemporalUnit.NATIVE
,TemporalUnit.OFFSET
,TemporalUnit.DATE
,TemporalUnit.TIME
,TemporalUnit.WEEK_OF_YEAR
, norTemporalUnit.WEEK_OF_MONTH
, which are already desugared byExtractFunction
.
-
translateDurationField
public String translateDurationField(TemporalUnit unit)
Return the name used to identify the given unit of duration as an argument to#timestampadd()
or#timestampdiff()
, or of this dialect's equivalent functions.This method does not need to handle
TemporalUnit.NANOSECOND
,TemporalUnit.NATIVE
,TemporalUnit.OFFSET
,TemporalUnit.DAY_OF_WEEK
,TemporalUnit.DAY_OF_MONTH
,TemporalUnit.DAY_OF_YEAR
,TemporalUnit.DATE
,TemporalUnit.TIME
,TemporalUnit.TIMEZONE_HOUR
,TemporalUnit.TIMEZONE_MINUTE
,TemporalUnit.WEEK_OF_YEAR
, norTemporalUnit.WEEK_OF_MONTH
, which are not units of duration.
-
appendDateTimeLiteral
public void appendDateTimeLiteral(SqlAppender appender, TemporalAccessor temporalAccessor, jakarta.persistence.TemporalType precision, TimeZone jdbcTimeZone)
-
appendDateTimeLiteral
public void appendDateTimeLiteral(SqlAppender appender, Date date, jakarta.persistence.TemporalType precision, TimeZone jdbcTimeZone)
-
appendDateTimeLiteral
public void appendDateTimeLiteral(SqlAppender appender, Calendar calendar, jakarta.persistence.TemporalType precision, TimeZone jdbcTimeZone)
-
appendIntervalLiteral
public void appendIntervalLiteral(SqlAppender appender, Duration literal)
-
appendUUIDLiteral
public void appendUUIDLiteral(SqlAppender appender, UUID literal)
-
supportsTemporalLiteralOffset
public boolean supportsTemporalLiteralOffset()
Whether the Dialect supports timezone offset in temporal literals.
-
getTimeZoneSupport
public TimeZoneSupport getTimeZoneSupport()
How the Dialect supports time zone types likeTypes.TIMESTAMP_WITH_TIMEZONE
.
-
getFallbackSchemaManagementTool
public SchemaManagementTool getFallbackSchemaManagementTool(Map<String,Object> configurationValues, ServiceRegistryImplementor registry)
The SchemaManagementTool to use if none explicitly specified.Allows Dialects to override how schema tooling works by default
-
-