Class Dialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- All Implemented Interfaces:
FunctionContributor,TypeContributor,ConversionContext
- Direct Known Subclasses:
AbstractHANADialect,AbstractTransactSQLDialect,CockroachDialect,DB2Dialect,DerbyDialect,DialectDelegateWrapper,GenericDialect,H2Dialect,HSQLDialect,MySQLDialect,OracleDialect,PostgreSQLDialect,SpannerDialect
public abstract class Dialect extends Object implements ConversionContext, TypeContributor, FunctionContributor
Represents a dialect of SQL implemented by a particular RDBMS. Every subclass of this class implements support for a certain database platform. For example,PostgreSQLDialectimplements support for PostgreSQL, andMySQLDialectimplements 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:
columnType(int)to define a mapping from SQL type codes to database column types, andinitializeFunctionRegistry(FunctionContributions)to register mappings for standard HQL functions with theSqmFunctionRegistry.
A subclass representing a dialect of SQL which deviates significantly from ANSI SQL will certainly override many additional operations.
Subclasses should be thread-safe and immutable.
Since Hibernate 6, a single subclass of
Dialectrepresents all releases of a given product-specific SQL dialect. The version of the database is exposed at runtime via theDialectResolutionInfopassed to the constructor, and by thegetVersion()property.Programs using Hibernate should migrate away from the use of versioned dialect classes like, for example,
MySQL8Dialect. These classes are now deprecated and will be removed in a future release.A custom
Dialectmay be specified using the configuration property "hibernate.dialect", but for supported databases this property is unnecessary, and Hibernate will select the correctDialectbased on the JDBC URL andDialectResolutionInfo.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDialect.SizeStrategyPluggable strategy for determining theSizeto use for columns of a given SQL type.classDialect.SizeStrategyImpl
-
Field Summary
Fields Modifier and Type Field Description static StringCLOSED_QUOTECharacters used as closing for quoting SQL identifiersprotected static String[]FALSE_STRING_VALUESprotected static LobMergeStrategyLEGACY_LOB_MERGE_STRATEGYALobMergeStrategyrepresenting the legacy behavior of Hibernate.protected static doubleLOG_BASE2OF10protected static LobMergeStrategyNEW_LOCATOR_LOB_MERGE_STRATEGYALobMergeStrategybased on creating a new LOB locator.static StringQUOTECharacters used as opening for quoting SQL identifiersprotected MultiKeyLoadSizingStrategySTANDARD_MULTI_KEY_LOAD_SIZING_STRATEGYprotected static LobMergeStrategySTREAM_XFER_LOB_MERGE_STRATEGYALobMergeStrategybased on transferring contents using streams.protected static String[]TRUE_STRING_VALUES
-
Constructor Summary
Constructors Modifier Constructor Description protectedDialect()Deprecated.provide aDatabaseVersionprotectedDialect(DatabaseVersion version)protectedDialect(DialectResolutionInfo info)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringaddSqlHintOrComment(String sql, QueryOptions queryOptions, boolean commentsEnabled)Modify the SQL, adding hints or comments, if necessaryvoidappendArrayLiteral(SqlAppender appender, Object[] literal, JdbcLiteralFormatter<Object> elementFormatter, WrapperOptions wrapperOptions)Append an array literal with the given elements to the givenSqlAppender.voidappendBinaryLiteral(SqlAppender appender, byte[] bytes)Append a binary literal to the givenSqlAppender.voidappendBooleanValueString(SqlAppender appender, boolean bool)Append the SQL literal expression representing the given boolean value to the givenSqlAppender.voidappendDatetimeFormat(SqlAppender appender, String format)Translate the given datetime format string from the pattern language defined by Java'sDateTimeFormatterto whatever pattern language is understood by the native datetime formatting function for this database (often theto_char()function).voidappendDateTimeLiteral(SqlAppender appender, TemporalAccessor temporalAccessor, TemporalType precision, TimeZone jdbcTimeZone)Append a datetime literal representing the givenjava.timevalue to the givenSqlAppender.voidappendDateTimeLiteral(SqlAppender appender, Calendar calendar, TemporalType precision, TimeZone jdbcTimeZone)Append a datetime literal representing the givenCalendarvalue to the givenSqlAppender.voidappendDateTimeLiteral(SqlAppender appender, Date date, TemporalType precision, TimeZone jdbcTimeZone)Append a datetime literal representing the givenDatevalue to the givenSqlAppender.voidappendIntervalLiteral(SqlAppender appender, Duration literal)Append a literal SQLintervalrepresenting the given JavaDuration.voidappendLiteral(SqlAppender appender, String literal)Append a literal string to the givenSqlAppender.StringappendLockHint(LockOptions lockOptions, String tableName)Some dialects support an alternative means toSELECT FOR UPDATE, whereby a "lock hint" is appended to the table name in thefromclause.voidappendUUIDLiteral(SqlAppender appender, UUID literal)Append a literal SQLuuidrepresenting the given JavaUUID.StringapplyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String,String[]> keyColumnNames)Modifies the given SQL, applying the appropriate updates for the specified lock modes and key columns.voidaugmentPhysicalTableTypes(List<String> tableTypesList)voidaugmentRecognizedTableTypes(List<String> tableTypesList)IdentifierHelperbuildIdentifierHelper(IdentifierHelperBuilder builder, @Nullable DatabaseMetaData dbMetaData)TheIdentifierHelperindicated by this dialect for handling identifier conversions.SQLExceptionConversionDelegatebuildSQLExceptionConversionDelegate()An instance ofSQLExceptionConversionDelegatefor interpreting dialect-specific error or SQLState codes.protected StringbuildStringToBooleanCast(String trueValue, String falseValue)protected StringbuildStringToBooleanCastDecode(String trueValue, String falseValue)protected StringbuildStringToBooleanDecode(String trueValue, String falseValue)booleancanBatchTruncate()Does thetruncate tablestatement accept multiple tables?booleancanCreateCatalog()Does this dialect support creating and dropping catalogs?booleancanCreateSchema()Does this dialect support creating and dropping schema?booleancanDisableConstraints()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.)StringcastPattern(CastType from, CastType to)Obtain a pattern for the SQL equivalent to acast()function call.protected StringcastType(int sqlTypeCode)The SQL type to use incast( ... as ... )expressions when casting to the target type represented by the given JDBC type code.protected voidcheckVersion()charcloseQuote()The character specific to this dialect used to close a quoted identifier.protected StringcolumnType(int sqlTypeCode)voidcontribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry)Contribute typesvoidcontributeFunctions(FunctionContributions functionContributions)Contribute functionsvoidcontributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)A callback which allows theDialectto contribute types.MutationOperationcreateOptionalTableUpdateOperation(EntityMutationTarget mutationTarget, org.hibernate.sql.model.internal.OptionalTableUpdate optionalTableUpdate, SessionFactoryImplementor factory)Create aMutationOperationfor a updating an optional tableStringcurrentDate()StringcurrentLocalTime()Translation of the HQLlocal_timefunction, which maps to the Java typeLocalTimewhich is a time with no time zone.StringcurrentLocalTimestamp()Translation of the HQLlocal_datetimefunction, which maps to the Java typeLocalDateTimewhich is a datetime with no time zone.StringcurrentTime()Translation of the HQL/JPQLcurrent_timefunction, which maps to the Java typeTimewhich is a time with no time zone.StringcurrentTimestamp()Translation of the HQL/JPQLcurrent_timestampfunction, which maps to the Java typeTimestampwhich is a datetime with no time zone.StringcurrentTimestampWithTimeZone()Translation of the HQLoffset_datetimefunction, which maps to the Java typeOffsetDateTimewhich is a datetime with a time zone.ScrollModedefaultScrollMode()A defaultScrollModeto be used byQuery.scroll().booleandoesReadCommittedCauseWritersToBlockReaders()For the underlying database, isREAD_COMMITTEDisolation implemented by forcing readers to wait for write locks to be released?booleandoesRepeatableReadCauseReadersToBlockWriters()For the underlying database, isREPEATABLE_READisolation implemented by forcing writers to wait for read locks to be released?booleandoesRoundTemporalOnOverflow()Does this dialect round a temporal when converting from a precision higher to a lower one?booleandropConstraints()Do we need to drop constraints before dropping tables in this dialect?booleanequivalentTypes(int typeCode1, int typeCode2)Do the given JDBC type codes, as defined inTypesrepresent essentially the same type in this dialect of SQL?static StringescapeComment(String comment)Perform necessary character escaping on the text of the comment.StringextractPattern(TemporalUnit unit)Obtain a pattern for the SQL equivalent to anextract()function call.booleanforceLobAsLastValue()Must LOB values occur last in inserts and updates?StringgeneratedAs(String generatedAs)Thegenerated asclause, or similar, for generated column declarations in DDL statements.StringgetAddColumnString()The subcommand of thealter tablecommand used to add a column to a table, usuallyadd columnoradd.StringgetAddColumnSuffixString()The syntax for the suffix used to add a column to a table.StringgetAddForeignKeyConstraintString(String constraintName, String foreignKeyDefinition)The syntax used to add a foreign key constraint to a table, given the definition of the foreign key as a string.StringgetAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)The syntax used to add a foreign key constraint to a table, with the referenced key columns explicitly specified.StringgetAddPrimaryKeyConstraintString(String constraintName)The syntax used to add a primary key constraint to a table.AggregateSupportgetAggregateSupport()How does this dialect support aggregate types likeSqlTypes.STRUCT.StringgetAlterColumnTypeString(String columnName, String columnType, String columnDefinition)The fragment of analter tablecommand which modifies a column type, or null if column types cannot be modified.StringgetAlterTableString(String tableName)The command used to alter a table with the given name, usuallyalter table tab_nameoralter table tab_name if exists.StringgetArrayTypeName(String javaElementTypeName, String elementTypeName, Integer maxLength)The SQL type name for the array type with elements of the given type name.Exporter<AuxiliaryDatabaseObject>getAuxiliaryDatabaseObjectExporter()MultiKeyLoadSizingStrategygetBatchLoadSizingStrategy()The strategy used to determine the appropriate number of keys to load in a single SQL query with batch-fetch loading.StringgetBeforeDropStatement()A command to execute before dropping tables.CallableStatementSupportgetCallableStatementSupport()TheCallableStatementSupportfor this database.StringgetCascadeConstraintsString()The keyword that specifies that adrop tableoperation 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.StringgetCaseInsensitiveLike()The name of the SQL operator that performs case-insensitiveLIKEcomparisons.StringgetCheckCondition(String columnName, long[] values)Deprecated, for removal: This API element is subject to removal in a future version.usegetCheckCondition(String, Long[])insteadStringgetCheckCondition(String columnName, long min, long max)Render a SQL check condition for a column that represents an enumerated value.StringgetCheckCondition(String columnName, Class<? extends Enum<?>> enumType)StringgetCheckCondition(String columnName, Long[] values)Render a SQL check condition for a column that represents an enumerated value by its ordinal representation or a given list of values.StringgetCheckCondition(String columnName, String[] values)Render a SQL check condition for a column that represents an enumerated value by its string representation or a given list of values (with NULL value allowed).ColumnAliasExtractorgetColumnAliasExtractor()AColumnAliasExtractor, usually justResultSetMetaData.getColumnLabel(int).StringgetColumnComment(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 catalog.String[]getCreateEnumTypeCommand(Class<? extends Enum<?>> enumType)String[]getCreateEnumTypeCommand(String name, String[] values)StringgetCreateIndexString(boolean unique)The command used to create an index, usuallycreate indexorcreate unique index.StringgetCreateIndexTail(boolean unique, List<Column> columns)A string to be appended to the end of thecreate indexcommand, usually to specify thatnullvalues are to be considered distinct.StringgetCreateMultisetTableString()Slight variation ongetCreateTableString().String[]getCreateSchemaCommand(String schemaName)Get the SQL command used to create the named schema.StringgetCreateTableString()The command used to create a table, usuallycreate table.StringgetCreateTemporaryTableColumnAnnotation(int sqlTypeCode)Annotation to be appended to the end of each COLUMN clause for temporary tables.StringgetCreateUserDefinedTypeExtensionsString()An arbitrary extension to append to the end of the UDTcreate typecommand.StringgetCreateUserDefinedTypeKindString()The kind of user-defined type to create, or the empty string if this does not need to be specified.StringgetCrossReferenceParentTableFilter()Some dialects require a not null primaryTable filter.StringgetCurrentSchemaCommand()Get the SQL command used to retrieve the current schema name.StringgetCurrentTimestampSelectString()The command used to retrieve the current timestamp from the database.intgetDefaultDecimalPrecision()This is the default precision for a generated column of exact numeric typeDECIMALorNUMERICmapped to aBigIntegerorBigDecimal.intgetDefaultIntervalSecondScale()This is the default scale for a generated column of typeINTERVAL SECONDmapped to aDuration.longgetDefaultLobLength()booleangetDefaultNonContextualLobCreation()The default value to use for the configuration property "hibernate.jdbc.lob.non_contextual_creation".PropertiesgetDefaultProperties()Retrieve a set of default Hibernate properties for this database.intgetDefaultStatementBatchSize()The default value to use for the configuration property "hibernate.jdbc.batch_size".intgetDefaultTimestampPrecision()This is the default precision for a generated column of typeTIMESTAMPmapped to aTimestamporLocalDateTime.booleangetDefaultUseGetGeneratedKeys()The default value to use for the configuration property "hibernate.jdbc.use_get_generated_keys".StringgetDisableConstraintsStatement()A SQL statement that temporarily disables foreign key constraint checking for all tables.StringgetDisableConstraintStatement(String tableName, String name)A SQL statement that temporarily disables checking of the given foreign key constraint.DmlTargetColumnQualifierSupportgetDmlTargetColumnQualifierSupport()Get the minimumDmlTargetColumnQualifierSupportrequired by this dialect.intgetDoublePrecision()This is the default precision for a generated column mapped to a JavaDoubleordouble.String[]getDropCatalogCommand(String catalogName)Get the SQL command used to drop the named catalog.String[]getDropEnumTypeCommand(Class<? extends Enum<?>> enumType)String[]getDropEnumTypeCommand(String name)StringgetDropForeignKeyString()The subcommand of thealter tablecommand used to drop a foreign key constraint, usuallydrop constraint.String[]getDropSchemaCommand(String schemaName)Get the SQL command used to drop the named schema.StringgetDropTableString(String tableName)Deprecated.No longer usedStringgetDropUniqueKeyString()The subcommand of thealter tablecommand used to drop a unique key constraint.StringgetDual()Returns a table expression that has one row.StringgetEnableConstraintsStatement()A SQL statement that re-enables foreign key constraint checking for all tables.StringgetEnableConstraintStatement(String tableName, String name)A SQL statement that re-enables checking of the given foreign key constraint.StringgetEnumTypeDeclaration(Class<? extends Enum<?>> enumType)StringgetEnumTypeDeclaration(String name, String[] values)If this database has a special MySQL-styleenumcolumn type, return the type declaration for the given enumeration of values.SchemaManagementToolgetFallbackSchemaManagementTool(Map<String,Object> configurationValues, ServiceRegistryImplementor registry)TheSchemaManagementToolto use if none is explicitly specified.SqmMultiTableInsertStrategygetFallbackSqmInsertStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)TheSqmMultiTableInsertStrategyto use when not specified byQueryEngineOptions.getCustomSqmMultiTableInsertStrategy().SqmMultiTableMutationStrategygetFallbackSqmMutationStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)TheSqmMultiTableMutationStrategyto use when not specified byQueryEngineOptions.getCustomSqmMultiTableMutationStrategy().intgetFloatPrecision()This is the default precision for a generated column mapped to a JavaFloatorfloat.Exporter<ForeignKey>getForeignKeyExporter()StringgetForUpdateNowaitString()Retrieves theFOR UPDATE NOWAITsyntax specific to this dialect.StringgetForUpdateNowaitString(String aliases)Get theFOR UPDATE OF column_list NOWAITfragment appropriate for this dialect, given the aliases of the columns to be write locked.StringgetForUpdateSkipLockedString()Retrieves theFOR UPDATE SKIP LOCKEDsyntax specific to this dialect.StringgetForUpdateSkipLockedString(String aliases)Get theFOR UPDATE OF column_list SKIP LOCKEDfragment appropriate for this dialect, given the aliases of the columns to be write locked.StringgetForUpdateString()Get the string to append toSELECTstatements to acquire pessimistic UPGRADE locks for this dialect.StringgetForUpdateString(String aliases)Get theFOR UPDATE OF column_listfragment appropriate for this dialect, given the aliases of the columns to be write locked.StringgetForUpdateString(String aliases, LockOptions lockOptions)Get theFOR UPDATE OForFOR SHARE OFfragment appropriate for this dialect, given the aliases of the columns to be locked.StringgetForUpdateString(LockMode lockMode)Given aLockMode, determine the appropriatefor updatefragment to use to obtain the lock.StringgetForUpdateString(LockOptions lockOptions)Given a set ofLockOptions(lock level, timeout), determine the appropriatefor updatefragment to use to obtain the lock.longgetFractionalSecondPrecisionInNanos()The "native" precision for arithmetic with datetimes and day-to-second durations.StringgetFromDualForSelectOnly()FunctionalDependencyAnalysisSupportgetFunctionalDependencyAnalysisSupport()Get this dialect's level of support for primary key functional dependency analysis withinGROUP BYandORDER BYclauses.SelectItemReferenceStrategygetGroupBySelectItemReferenceStrategy()Determine how selected items are referenced in thegroup byclause.HqlTranslatorgetHqlTranslator()Return anHqlTranslatorspecific to this dialect, ornullto use the standard translator.IdentityColumnSupportgetIdentityColumnSupport()Get the appropriateIdentityColumnSupportfor this dialect.Exporter<Index>getIndexExporter()intgetInExpressionCountLimit()Return the limit that the underlying database places on the number of elements in anINpredicate.Set<String>getKeywords()The keywords of this SQL dialect.LimitHandlergetLimitHandler()Obtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).LobMergeStrategygetLobMergeStrategy()Get theLobMergeStrategyto use,NEW_LOCATOR_LOB_MERGE_STRATEGYby default.LockingStrategygetLockingStrategy(Lockable lockable, LockMode lockMode)ALockingStrategywhich is able to acquire a database-level lock with the specified level.RowLockStrategygetLockRowIdentifier(LockMode lockMode)Obtain aRowLockStrategyfor the givenLockMode.StringgetLowercaseFunction()The name of the SQL function that transforms a string to lowercase, almost alwayslower.intgetMaxAliasLength()What is the maximum length Hibernate can use for generated aliases?intgetMaxIdentifierLength()What is the maximum identifier length supported by this dialect?intgetMaxNVarcharCapacity()The longest possible length of aTypes.NVARCHAR-like column.intgetMaxNVarcharLength()The biggest size value that can be supplied as argument to aTypes.NVARCHAR-like type.intgetMaxVarbinaryCapacity()The longest possible length of aTypes.VARBINARY-like column.intgetMaxVarbinaryLength()The biggest size value that can be supplied as argument to aTypes.VARBINARY-like type.intgetMaxVarcharCapacity()The longest possible length of aTypes.VARCHAR-like column.intgetMaxVarcharLength()The biggest size value that can be supplied as argument to aTypes.VARCHAR-like type.protected DatabaseVersiongetMinimumSupportedVersion()Get the version of the SQL dialect that is the minimum supported by this implementation.MultiKeyLoadSizingStrategygetMultiKeyLoadSizingStrategy()The strategy used to determine the appropriate number of keys to load in a single SQL query with multi-key loading.NameQualifierSupportgetNameQualifierSupport()NationalizationSupportgetNationalizationSupport()Determines whether this database requires the use of explicitly nationalized character (Unicode) data types.StringgetNativeIdentifierGeneratorStrategy()The name identifying the "native" id generation strategy for this dialect.ParameterMarkerStrategygetNativeParameterMarkerStrategy()Support for native parameter markers.StringgetNoColumnsInsertString()Deprecated.Override the methodrenderInsertIntoNoColumns()on thetranslatorreturned by this dialect.StringgetNullColumnString()The keyword used to specify a nullable column, usually"", but sometimes" null".StringgetNullColumnString(String columnType)The keyword used to specify a nullable column of the given SQL type.NullOrderinggetNullOrdering()Returns the default ordering of null.intgetParameterCountLimit()Return the limit that the underlying database places on the number of parameters that can be defined for a PreparedStatement.intgetPreferredSqlTypeCodeForArray()The JDBC type code to use for mapping properties of basic Java array orCollectiontypes.intgetPreferredSqlTypeCodeForBoolean()The JDBC type code to use for mapping properties of Java typeboolean.StringgetQueryHintString(String query, String hints)Apply a hint to the given SQL query.StringgetQueryHintString(String query, List<String> hintList)Apply a hint to the given SQL query.StringgetQuerySequencesString()Get theselectcommand used retrieve the names of all sequences.StringgetReadLockString(int timeout)Get the string to append toSELECTstatements to acquire READ locks for this dialect.StringgetReadLockString(String aliases, int timeout)Get the string to append toSELECTstatements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.RowLockStrategygetReadRowLockStrategy()The row lock strategy to use for read locks.ResultSetgetResultSet(CallableStatement statement)Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom theOUTparameter.ResultSetgetResultSet(CallableStatement statement, int position)Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the positionalOUTparameter.ResultSetgetResultSet(CallableStatement statement, String name)Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the namedOUTparameter.StringgetRowIdColumnString(String rowId)If this dialect requires that therowidcolumn be declared explicitly, return the DDL column definition.SchemaNameResolvergetSchemaNameResolver()Get the strategy for determining the schema name from a JDBCConnection, usuallyDefaultSchemaNameResolver.StringgetSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration)Given a JDBC type code, return the expression for a literal null value of that type, to use in aselectclause.StringgetSelectGUIDString()Get the command used to select a GUID from the database.Exporter<Sequence>getSequenceExporter()SequenceInformationExtractorgetSequenceInformationExtractor()ASequenceInformationExtractorwhich is able to extractSequenceInformationfrom the JDBC result set returned whengetQuerySequencesString()is executed.SequenceSupportgetSequenceSupport()Get the appropriateSequenceSupportfor this dialect.Dialect.SizeStrategygetSizeStrategy()A customDialect.SizeStrategyfor column types.SqlAstTranslatorFactorygetSqlAstTranslatorFactory()SqmTranslatorFactorygetSqmTranslatorFactory()Return aSqmTranslatorFactoryspecific to this dialect, ornullto use the standard translator.TemporaryTableKindgetSupportedTemporaryTableKind()The kind of temporary tables that are supported on this database.CleanergetTableCleaner()Get a schemaCleaner, usuallyStandardTableCleaner.StringgetTableComment(String comment)Get the comment into a form supported for table definition.Exporter<Table>getTableExporter()org.hibernate.tool.schema.internal.TableMigratorgetTableMigrator()Get aTableMigrator, usuallyStandardTableMigrator.StringgetTableTypeString()An arbitrary fragment appended to the end of thecreate tablestatement.org.hibernate.query.sqm.mutation.internal.temptable.AfterUseActiongetTemporaryTableAfterUseAction()The action to take after finishing use of a temporary table.org.hibernate.query.sqm.mutation.internal.temptable.BeforeUseActiongetTemporaryTableBeforeUseAction()The action to take before beginning use of a temporary table.StringgetTemporaryTableCreateCommand()The command to create a temporary table.StringgetTemporaryTableCreateOptions()An arbitrary SQL fragment appended to the end of the statement to create a temporary table, specifying dialect-specific options, ornullif there are no options to specify.TempTableDdlTransactionHandlinggetTemporaryTableDdlTransactionHandling()The sort of transaction handling to use when creating or dropping temporary tables.StringgetTemporaryTableDropCommand()The command to drop a temporary table.TemporaryTableExportergetTemporaryTableExporter()Get aTemporaryTableExporter, usuallyStandardTemporaryTableExporter.StringgetTemporaryTableTruncateCommand()The command to truncate a temporary table.protected intgetTimeoutInSeconds(int millis)TimeZoneSupportgetTimeZoneSupport()How the dialect supports time zone types likeTypes.TIMESTAMP_WITH_TIMEZONE.StringgetTruncateTableStatement(String tableName)A SQL statement that truncates the given table.String[]getTruncateTableStatements(String[] tableNames)A SQL statement or statements that truncate the given tables.UniqueDelegategetUniqueDelegate()Get theUniqueDelegatesupported by this dialectExporter<Constraint>getUniqueKeyExporter()StringgetUserDefinedTypeComment(String comment)Get the comment into a form supported for UDT definition.Exporter<UserDefinedType>getUserDefinedTypeExporter()DatabaseVersiongetVersion()Get the version of the SQL dialect that is the target of this instance.ViolatedConstraintNameExtractorgetViolatedConstraintNameExtractor()AViolatedConstraintNameExtractorfor extracting the name of a violated constraint from aSQLException.StringgetWriteLockString(int timeout)Get the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.StringgetWriteLockString(String aliases, int timeout)Get the string to append toSELECTstatements to acquire WRITE locks for this dialect, given the aliases of the columns to be write locked.RowLockStrategygetWriteRowLockStrategy()The row lock strategy to use for write locks.booleanhasAlterTable()Does this dialect support theALTER TABLEsyntax?booleanhasDataTypeBeforeGeneratedAs()Is an explicit column type required forgenerated ascolumns?booleanhasSelfReferentialForeignKeyBug()Does the database/driver have bug in deleting rows that refer to other rows being deleted in the same query?protected voidinitDefaultProperties()Set appropriate default values for configuration properties.voidinitializeFunctionRegistry(FunctionContributions functionContributions)Initialize the given registry with any dialect-specific functions.StringinlineLiteral(String literal)Deprecated, for removal: This API element is subject to removal in a future version.This is no longer calledbooleanisAnsiNullOn()Deprecated.This is only called fromSybaseASESqlAstTranslatorso it doesn't need to be declared here.booleanisCurrentTimestampSelectStringCallable()Is the command returned bygetCurrentTimestampSelectString()treated as callable?booleanisEmptyStringTreatedAsNull()Return whether the dialect considers an empty string value to be null.booleanisJdbcLogWarningsEnabledByDefault()Is JDBC statement warning logging enabled by default?protected booleanisLob(int sqlTypeCode)booleanisLockTimeoutParameterized()Deprecated, for removal: This API element is subject to removal in a future version.This is never called, and since at least Hibernate 5 has just returnedfalsein every dialect.charopenQuote()The character specific to this dialect used to begin a quoted identifier.intordinal()Determines order in which the contributions will be applied (lowest ordinal first).protected StringprependComment(String sql, String comment)Prepend a comment to the given SQL fragment.booleanqualifyIndexName()Do we need to qualify index names with the schema name?Stringquote(String name)Apply dialect-specific quoting if the given name is quoted using backticks.StringquoteCollation(String collation)Quote the given collation name if necessary.protected voidregisterColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)Register ANSI-standard column types using the length limits defined bygetMaxVarcharLength(),getMaxNVarcharLength(), andgetMaxVarbinaryLength().protected voidregisterDefaultKeywords()Register the reserved words of ANSI-standard SQL as keywords.protected voidregisterKeyword(String word)Register a keyword.protected voidregisterKeywords(DialectResolutionInfo info)Register the reserved words reported by the JDBC driver as keywords.intregisterResultSetOutParameter(CallableStatement statement, int position)Registers a parameter capable of returning aResultSetby position, either anOUTparameter, or aREF_CURSORparameter as defined in Java 8.intregisterResultSetOutParameter(CallableStatement statement, String name)Registers a parameter capable of returning aResultSetby name, either anOUTparameter, or aREF_CURSORparameter as defined in Java 8.booleanrequiresCastForConcatenatingNonStrings()Does this dialect/database require casting of non-string arguments in theconcat()function?booleanrequiresFloatCastingOfIntegerDivision()Does this dialect require that integer divisions be wrapped incast()calls to tell the db parser the expected type.booleanrequiresParensForTupleCounts()IfsupportsTupleCounts()is true, does this dialect require the tuple to be delimited with parentheses?booleanrequiresParensForTupleDistinctCounts()IfsupportsTupleDistinctCounts()is true, does this dialect require the tuple to be delimited with parentheses?protected IntegerresolveSqlTypeCode(String typeName, String baseTypeName, TypeConfiguration typeConfiguration)Resolves theSqlTypestype code for the given column type name as reported by the database and the base type name (i.e.protected IntegerresolveSqlTypeCode(String columnTypeName, TypeConfiguration typeConfiguration)Resolves theSqlTypestype code for the given column type name as reported by the database, ornullif it can't be resolved.JdbcTyperesolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)Assigns an appropriateJdbcTypeto a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.intresolveSqlTypeLength(String columnTypeName, int jdbcTypeCode, int precision, int scale, int displaySize)Determine the length/precision of a column based on information in the JDBCResultSetMetaData.StringrowId(String rowId)The name of arowid-like pseudo-column which acts as a high-performance row locator, or null if this dialect has no such pseudo-column.introwIdSqlType()The JDBC type code of therowid-like pseudo-column which acts as a high-performance row locator.booleansupportsAlterColumnType()Does this dialect support modifying the type of an existing column?BooleansupportsBatchUpdates()Whether this Dialect supports batch updates.booleansupportsBindAsCallableArgument()Does this dialect support using a JDBC bind parameter as an argument to a function or procedure call?booleansupportsBitType()booleansupportsCascadeDelete()Does this dialect supporton deleteactions in foreign key definitions?booleansupportsCaseInsensitiveLike()Does this dialect support case-insensitiveLIKEcomparisons?booleansupportsCircularCascadeDeleteConstraints()Does this dialect support definition of cascade delete constraints which can cause circular chains?booleansupportsColumnCheck()Does this dialect support column-level check constraints?booleansupportsCommentOn()Does this dialect support commenting on tables and columns?booleansupportsConflictClauseForInsertCTE()Does this dialect support theconflictclause for insert statements that appear in a CTE?booleansupportsCurrentTimestampSelection()Does this dialect support some way to retrieve the current timestamp value from the database?booleansupportsDistinctFromPredicate()Does this dialect support some kind ofdistinct frompredicate?booleansupportsExistsInSelect()Does the dialect support an exists statement in the select clause?booleansupportsExpectedLobUsagePattern()"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.booleansupportsFetchClause(FetchClauseType type)Does this dialect support the givenFETCHclause type.booleansupportsFractionalTimestampArithmetic()Whether the database supports adding a fractional interval to a timestamp, for exampletimestamp + 0.5 second.booleansupportsFromClauseInUpdate()Does this dialect support thefromclause for update statements?booleansupportsIfExistsAfterAlterTable()For analter table, can the phraseif existsbe applied?booleansupportsIfExistsAfterConstraintName()For dropping a constraint with analter table, can the phraseif existsbe applied after the constraint name?booleansupportsIfExistsAfterTableName()For dropping a table, can the phraseif existsbe applied after the table name?booleansupportsIfExistsAfterTypeName()For dropping a type, can the phraseif existsbe applied after the type name?booleansupportsIfExistsBeforeConstraintName()For dropping a constraint with analter tablestatement, can the phraseif existsbe applied before the constraint name?booleansupportsIfExistsBeforeTableName()For dropping a table, can the phraseif existsbe applied before the table name?booleansupportsIfExistsBeforeTypeName()For dropping a type, can the phraseif existsbe applied before the type name?booleansupportsInsertReturning()Does this dialect fully support returning arbitrary generated column values after execution of aninsertstatement, using native SQL syntax?booleansupportsInsertReturningGeneratedKeys()Does this dialect fully support returning arbitrary generated column values after execution of aninsertstatement, using the JDBC methodConnection.prepareStatement(String, String[]).booleansupportsInsertReturningRowId()Does this dialect supports returning theRowIdcolumn after execution of aninsertstatement, using native SQL syntax?booleansupportsIsTrue()Does this dialect support theis trueandis falseoperators?booleansupportsJdbcConnectionLobCreation(DatabaseMetaData databaseMetaData)Check whether the JDBCConnectionsupports creating LOBs viaConnection.createBlob(),Connection.createNClob(), orConnection.createClob().booleansupportsLateral()Does this dialect support the SQLlateralkeyword or a proprietary alternative?booleansupportsLobValueChangePropagation()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.booleansupportsLockTimeouts()Does this dialect support specifying timeouts when requesting locks.booleansupportsMaterializedLobAccess()Check whether the JDBC driver allows setting LOBs viaPreparedStatement.setBytes(int, byte[]),PreparedStatement.setNString(int, String), orPreparedStatement.setString(int, String)APIs.booleansupportsNamedParameters(@Nullable DatabaseMetaData databaseMetaData)booleansupportsNationalizedMethods()Checks whether the JDBC driver implements methods for handling nationalized character data typesResultSet.getNString(int)/PreparedStatement.setNString(int, String),ResultSet.getNClob(int)/PreparedStatement.setNClob(int, NClob),ResultSet.getNCharacterStream(int)/PreparedStatement.setNCharacterStream(int, Reader, long)booleansupportsNoColumnsInsert()Is theINSERTstatement is allowed to contain no columns?booleansupportsNonQueryWithCTE()Does this dialect support insert, update, and delete statements with Common Table Expressions (CTEs)?booleansupportsNoWait()Does this dialect supportNO_WAITtimeout.booleansupportsNullPrecedence()Does this dialect supportnulls firstandnulls last?booleansupportsOffsetInSubquery()Does this dialect supportoffsetin subqueries?booleansupportsOrderByInSubquery()Does this dialect support theorder byclause in subqueries?booleansupportsOrdinalSelectItemReference()Does this dialect support references to result variables (i.e, select items) by column positions (1-origin) as defined by the select clause?booleansupportsOuterJoinForUpdate()Does this dialect supportFOR UPDATEin conjunction with outer-joined rows?booleansupportsParametersInInsertSelect()Deprecated, for removal: This API element is subject to removal in a future version.This seems to be supported on all platforms, and we don't call this except in test suitebooleansupportsPartitionBy()Does is dialect supportpartition by?protected booleansupportsPredicateAsExpression()Whether a predicate likea > 0can appear in an expression context, for example, in aselectlist item.booleansupportsRecursiveCTE()Does this dialect/database support recursive CTEs?BooleansupportsRefCursors()Whether this Dialect supports the JDBCTypes.REF_CURSORtype.booleansupportsResultSetPositionQueryMethodsOnForwardOnlyCursor()Does this dialect support asking the result set its positioning information on forward-only cursors?booleansupportsSkipLocked()Does this dialect supportSKIP_LOCKEDtimeout.booleansupportsStandardArrays()Does this database have native support for ANSI SQL standard arrays which are expressed in terms of the element type name:integer array.booleansupportsStandardCurrentTimestampFunction()Does this dialect have an ANSI SQLcurrent_timestampfunction?booleansupportsSubqueryInSelect()Does this dialect support subqueries in theselectclause?booleansupportsSubqueryOnMutatingTable()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.booleansupportsSubselectAsInPredicateLHS()Is a subselect supported as the left-hand side (LHS) of anINpredicates?booleansupportsTableCheck()Does this dialect support table-level check constraints?booleansupportsTemporalLiteralOffset()Does this dialect supports timezone offsets in temporal literals.booleansupportsTemporaryTablePrimaryKey()Does this database support primary keys for temporary tables?booleansupportsTemporaryTables()Does this database have some sort of support for temporary tables?booleansupportsTruncateWithCast()Does this dialect support truncation of values to a specified length via acast?booleansupportsTupleCounts()Does this dialect supportcount(a,b)?booleansupportsTupleDistinctCounts()Does this dialect supportcount(distinct a,b)?booleansupportsUnboundedLobLocatorMaterialization()Is it supported to materialize a LOB locator outside the transaction in which it was created?booleansupportsUnionAll()Does this dialect supportUNION ALL?booleansupportsUnionInSubquery()Does this dialect supportUNIONin a subquery.booleansupportsUpdateReturning()Does this dialect fully support returning arbitrary generated column values after execution of anupdatestatement, using native SQL syntax?booleansupportsValuesList()Does this dialect supportvalueslists of formVALUES (1), (2), (3)?booleansupportsValuesListForInsert()Does this dialect supportvalueslists of formVALUES (1), (2), (3)in insert statements?booleansupportsWait()Does this dialect supportWAITtimeout.booleansupportsWindowFunctions()Does this dialect support window functions likerow_number() over (..)?StringtimestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType)Obtain a pattern for the SQL equivalent to atimestampadd()function call.StringtimestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType)Obtain a pattern for the SQL equivalent to atimestampdiff()function call.StringtoBooleanValueString(boolean bool)The SQL literal expression representing the given boolean value.StringtoQuotedIdentifier(String name)Apply dialect-specific quoting.StringtoString()StringtransformSelectString(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.StringtranslateDurationField(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.StringtranslateExtractField(TemporalUnit unit)Return the name used to identify the given field as an argument to theextract()function, or of this dialect's equivalent function.StringtrimPattern(TrimSpec specification, boolean isWhitespace)Obtain a pattern for the SQL equivalent to atrim()function call.StringtrimPattern(TrimSpec specification, char character)Deprecated, for removal: This API element is subject to removal in a future version.UsetrimPattern(TrimSpec, boolean)instead.booleanunquoteGetGeneratedKeys()Does this dialect require unquoting identifiers when passing them to theConnection.prepareStatement(String, String[])JDBC method.booleanuseArrayForMultiValuedParameters()Does this database prefer to use array types for multi-valued parameters.booleanuseConnectionToCreateLob()Should BLOB, CLOB, and NCLOB be created solely using respectivelyConnection.createBlob(),Connection.createClob(), andConnection.createNClob().booleanuseCrossReferenceForeignKeys()Does the dialect also need cross-references to get a complete list of foreign keys?booleanuseFollowOnLocking(String sql, QueryOptions queryOptions)Some dialects have trouble applying pessimistic locking depending upon what other query options are specified (paging, ordering, etc).booleanuseInputStreamToInsertBlob()Should LOBs (both BLOB and CLOB) be bound using stream operations, that is, usingPreparedStatement.setBinaryStream(int, java.io.InputStream, int)).booleanuseMaterializedLobWhenCapacityExceeded()Whether to switch: fromVARCHAR-like types toSqlTypes.MATERIALIZED_CLOBtypes when the requested size for a type exceeds thegetMaxVarcharCapacity(), fromNVARCHAR-like types toSqlTypes.MATERIALIZED_NCLOBtypes when the requested size for a type exceeds thegetMaxNVarcharCapacity(), and fromVARBINARY-like types toSqlTypes.MATERIALIZED_BLOBtypes when the requested size for a type exceeds thegetMaxVarbinaryCapacity().
-
-
-
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
-
TRUE_STRING_VALUES
protected static final String[] TRUE_STRING_VALUES
-
FALSE_STRING_VALUES
protected static final String[] FALSE_STRING_VALUES
-
LEGACY_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy LEGACY_LOB_MERGE_STRATEGY
ALobMergeStrategyrepresenting 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
ALobMergeStrategybased on transferring contents using streams.
-
NEW_LOCATOR_LOB_MERGE_STRATEGY
protected static final LobMergeStrategy NEW_LOCATOR_LOB_MERGE_STRATEGY
ALobMergeStrategybased on creating a new LOB locator.
-
STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY
protected final MultiKeyLoadSizingStrategy STANDARD_MULTI_KEY_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.This default implementation sets "hibernate.jdbc.batch_size", "hibernate.jdbc.lob.non_contextual_creation", and "hibernate.jdbc.use_get_generated_keys" to defaults determined by calling
getDefaultStatementBatchSize(),getDefaultNonContextualLobCreation(), andgetDefaultUseGetGeneratedKeys().An implementation may set additional configuration properties, but this is discouraged.
-
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
Dialectis instantiated.
-
isLob
protected boolean isLob(int sqlTypeCode)
-
columnType
protected String columnType(int sqlTypeCode)
The database column type name for a given JDBC type code defined inTypesorSqlTypes. This default implementation returns the ANSI-standard type name.This method may be overridden by concrete
Dialects as an alternative toregisterColumnTypes(TypeContributions, ServiceRegistry)for simple registrations.Note that:
- Implementations of this method are expected to define a
sensible mapping for
Types.NCLOBTypes.NCHAR, andTypes.NVARCHAR. On some database, these types are simply remapped toCLOB,CHAR, andVARCHAR. - Mappings for
Types.TIMESTAMPandTypes.TIMESTAMP_WITH_TIMEZONEshould 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-LONGcounterparts. - On the other hand, the types
SqlTypes.LONG32VARCHAR,SqlTypes.LONG32NVARCHAR, andSqlTypes.LONG32VARBINARYare not synonyms, and implementations of this method must define sensible mappings, for example to database-nativeTEXTorCLOBtypes.
- Implementations of this method are expected to define a
sensible mapping for
-
castType
protected String castType(int sqlTypeCode)
The SQL type to use incast( ... as ... )expressions when casting to the target type represented by the given JDBC type code.- Parameters:
sqlTypeCode- The JDBC type code representing the target type- Returns:
- The SQL type to use in
cast()
-
registerDefaultKeywords
protected void registerDefaultKeywords()
Register the reserved words of ANSI-standard SQL as keywords.- See Also:
AnsiSqlKeywords
-
registerKeywords
protected void registerKeywords(DialectResolutionInfo info)
Register the reserved words reported by the JDBC driver as keywords.- See Also:
DatabaseMetaData.getSQLKeywords()
-
getVersion
public DatabaseVersion getVersion()
Get the version of the SQL dialect that is the target of this instance.
-
getMinimumSupportedVersion
protected DatabaseVersion getMinimumSupportedVersion()
Get the version of the SQL dialect that is the minimum supported by this implementation.
-
resolveSqlTypeCode
protected Integer resolveSqlTypeCode(String columnTypeName, TypeConfiguration typeConfiguration)
Resolves theSqlTypestype code for the given column type name as reported by the database, ornullif it can't be resolved.
-
resolveSqlTypeCode
protected Integer resolveSqlTypeCode(String typeName, String baseTypeName, TypeConfiguration typeConfiguration)
Resolves theSqlTypestype code for the given column type name as reported by the database and the base type name (i.e. without precision, length and scale), ornullif it can't be resolved.
-
resolveSqlTypeDescriptor
public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
Assigns an appropriateJdbcTypeto 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)
Determine the length/precision of a column based on information in the JDBCResultSetMetaData. Note that what JDBC reports as a "precision" might actually be the column length.- Parameters:
columnTypeName- the name of the column typejdbcTypeCode- the JDBC type code of the column typeprecision- the (numeric) precision or (character) length of the columnscale- the scale of a numeric columndisplaySize- the display size of the column- Returns:
- the precision or length of the column
-
getEnumTypeDeclaration
public String getEnumTypeDeclaration(String name, String[] values)
If this database has a special MySQL-styleenumcolumn type, return the type declaration for the given enumeration of values.If the database has no such type, return
null.- Parameters:
values- the enumerated values of the type- Returns:
- the DDL column type declaration
-
getCreateEnumTypeCommand
public String[] getCreateEnumTypeCommand(Class<? extends Enum<?>> enumType)
-
getCheckCondition
public String getCheckCondition(String columnName, String[] values)
Render a SQL check condition for a column that represents an enumerated value by its string representation or a given list of values (with NULL value allowed).- Returns:
- a SQL expression that will occur in a
checkconstraint
-
getCheckCondition
public String getCheckCondition(String columnName, Class<? extends Enum<?>> enumType)
-
getCheckCondition
public String getCheckCondition(String columnName, long min, long max)
Render a SQL check condition for a column that represents an enumerated value. by its ordinal representation.- Returns:
- a SQL expression that will occur in a
checkconstraint
-
getCheckCondition
@Deprecated(forRemoval=true) public String getCheckCondition(String columnName, long[] values)
Deprecated, for removal: This API element is subject to removal in a future version.usegetCheckCondition(String, Long[])insteadRender a SQL check condition for a column that represents an enumerated value by its ordinal representation.- Returns:
- a SQL expression that will occur in a
checkconstraint
-
getCheckCondition
public String getCheckCondition(String columnName, Long[] values)
Render a SQL check condition for a column that represents an enumerated value by its ordinal representation or a given list of values.- Returns:
- a SQL expression that will occur in a
checkconstraint
-
contributeFunctions
public void contributeFunctions(FunctionContributions functionContributions)
Description copied from interface:FunctionContributorContribute functions- Specified by:
contributeFunctionsin interfaceFunctionContributor- Parameters:
functionContributions- The target for the contributions
-
ordinal
public int ordinal()
Description copied from interface:FunctionContributorDetermines order in which the contributions will be applied (lowest ordinal first).The range 0-500 is reserved for Hibernate, range 500-1000 for libraries and 1000-Integer.MAX_VALUE for user-defined FunctionContributors.
Contributions from higher precedence contributors (higher numbers) effectively override contributions from lower precedence. E.g. if a contributor with precedence 1000 contributes a function named
"max", that will override Hibernate's standard function of that name.- Specified by:
ordinalin interfaceFunctionContributor- Returns:
- the ordinal for this FunctionContributor
-
initializeFunctionRegistry
public void initializeFunctionRegistry(FunctionContributions functionContributions)
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.timetypes:-
local date -
local time -
local datetime -
offset datetime -
instant
-
left(string, length) -
right(string, length) -
replace(string, pattern, replacement) -
pad(string with length spec[ character]) -
repeat(string, times)
-
pi -
log10(arg) -
log(base, arg) -
sign(arg) -
sin(arg) -
cos(arg) -
tan(arg) -
asin(arg) -
acos(arg) -
atan(arg) -
atan2(arg0, arg1) -
round(arg0[, arg1]) -
truncate(arg0[, arg1]) -
sinh(arg) -
tanh(arg) -
cosh(arg) -
least(arg0, arg1, ...) -
greatest(arg0, arg1, ...) -
degrees(arg) -
radians(arg) -
bitand(arg1, arg1) -
bitor(arg1, arg1) -
bitxor(arg1, arg1)
-
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()
-
currentTime
public String currentTime()
Translation of the HQL/JPQLcurrent_timefunction, which maps to the Java typeTimewhich is a time with no time zone. This contradicts ANSI SQL wherecurrent_timehas the typeTIME WITH TIME ZONE.It is recommended to override this in dialects for databases which support
localtimeortime at local.
-
currentTimestamp
public String currentTimestamp()
Translation of the HQL/JPQLcurrent_timestampfunction, which maps to the Java typeTimestampwhich is a datetime with no time zone. This contradicts ANSI SQL wherecurrent_timestamphas the typeTIMESTAMP WITH TIME ZONE.It is recommended to override this in dialects for databases which support
localtimestamportimestamp at local.
-
currentLocalTime
public String currentLocalTime()
Translation of the HQLlocal_timefunction, which maps to the Java typeLocalTimewhich 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
localtimeorcurrent_time at local.
-
currentLocalTimestamp
public String currentLocalTimestamp()
Translation of the HQLlocal_datetimefunction, which maps to the Java typeLocalDateTimewhich 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
localtimestamporcurrent_timestamp at local.
-
currentTimestampWithTimeZone
public String currentTimestampWithTimeZone()
Translation of the HQLoffset_datetimefunction, which maps to the Java typeOffsetDateTimewhich is a datetime with a time zone. This in principle correctly maps to the ANSI SQLcurrent_timestampwhich 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.
-
buildStringToBooleanCast
protected String buildStringToBooleanCast(String trueValue, String falseValue)
-
buildStringToBooleanCastDecode
protected String buildStringToBooleanCastDecode(String trueValue, String falseValue)
-
buildStringToBooleanDecode
protected String buildStringToBooleanDecode(String trueValue, String falseValue)
-
getDual
public String getDual()
Returns a table expression that has one row.- Returns:
- the SQL equivalent to Oracle's
dual.
-
getFromDualForSelectOnly
public String getFromDualForSelectOnly()
-
trimPattern
@Deprecated(forRemoval=true) public String trimPattern(TrimSpec specification, char character)
Deprecated, for removal: This API element is subject to removal in a future version.UsetrimPattern(TrimSpec, boolean)instead.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-leadingortrailingcharacter- the character to trim
-
trimPattern
public String trimPattern(TrimSpec specification, boolean isWhitespace)
Obtain a pattern for the SQL equivalent to atrim()function call. The resulting pattern must contain a ?1 placeholder for the argument of typeStringand a ?2 placeholder for the trim character ifisWhitespacewas false.
-
supportsFractionalTimestampArithmetic
public boolean supportsFractionalTimestampArithmetic()
Whether the database supports adding a fractional interval to a timestamp, for exampletimestamp + 0.5 second.
-
timestampdiffPattern
public String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, 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, 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 inTypesrepresent essentially the same type in this dialect of SQL?The default implementation treats
NUMERICandDECIMALas the same type, andFLOAT,REAL, andDOUBLEas essentially the same type, since the ANSI SQL specification fails to meaningfully distinguish them.The default implementation also treats
VARCHAR,NVARCHAR,LONGVARCHAR, andLONGNVARCHARas the same type, andBINARYandLONGVARBINARYas the same type, since Hibernate doesn't really differentiate these types.On the other hand, integral types are not treated as equivalent, instead,
isCompatibleIntegralType(int, int)is responsible for determining if the types are compatible.- Parameters:
typeCode1- the first column type infotypeCode2- the second column type info- Returns:
trueif the two type codes are equivalent
-
getDefaultProperties
public Properties getDefaultProperties()
Retrieve a set of default Hibernate properties for this database.An implementation may set configuration properties from
initDefaultProperties(), though it is discouraged. the- Returns:
- the Hibernate configuration properties
- See Also:
initDefaultProperties()
-
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".
-
contribute
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Description copied from interface:TypeContributorContribute types- Specified by:
contributein interfaceTypeContributor- Parameters:
typeContributions- The callback for adding contributed typesserviceRegistry- The service registry
-
contributeTypes
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
A callback which allows theDialectto contribute types.- Parameters:
typeContributions- Callback to contribute the typesserviceRegistry- The service registry
-
getLobMergeStrategy
public LobMergeStrategy getLobMergeStrategy()
Get theLobMergeStrategyto use,NEW_LOCATOR_LOB_MERGE_STRATEGYby default.
-
getNativeIdentifierGeneratorStrategy
public String getNativeIdentifierGeneratorStrategy()
The name identifying the "native" id generation strategy for this dialect.This is the name of the id generation strategy which should be used when
"native"is specified inhbm.xml.- Returns:
- The name identifying the native generator strategy.
-
getIdentityColumnSupport
public IdentityColumnSupport getIdentityColumnSupport()
Get the appropriateIdentityColumnSupportfor this dialect.- Returns:
- the IdentityColumnSupport
- Since:
- 5.1
-
getSequenceSupport
public SequenceSupport getSequenceSupport()
Get the appropriateSequenceSupportfor this dialect.
-
getQuerySequencesString
public String getQuerySequencesString()
Get theselectcommand used retrieve the names of all sequences.- Returns:
- The select command; or null if sequences are not supported.
-
getSequenceInformationExtractor
public SequenceInformationExtractor getSequenceInformationExtractor()
ASequenceInformationExtractorwhich is able to extractSequenceInformationfrom the JDBC result set returned whengetQuerySequencesString()is executed.
-
getSelectGUIDString
public String getSelectGUIDString()
Get the command used to select a GUID from the database.Optional operation.
- Returns:
- The appropriate command.
-
supportsTemporaryTables
public boolean supportsTemporaryTables()
Does this database have some sort of support for temporary tables?- Returns:
- true by default, since most do
-
supportsTemporaryTablePrimaryKey
public boolean supportsTemporaryTablePrimaryKey()
Does this database support primary keys for temporary tables?- Returns:
- true by default, since most do
-
getLimitHandler
public LimitHandler getLimitHandler()
Obtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).
-
supportsLockTimeouts
public boolean supportsLockTimeouts()
Does this dialect support specifying timeouts when requesting locks.- Returns:
- True is this dialect supports specifying lock timeouts.
-
isLockTimeoutParameterized
@Deprecated(since="6", forRemoval=true) public boolean isLockTimeoutParameterized()
Deprecated, for removal: This API element is subject to removal in a future version.This is never called, and since at least Hibernate 5 has just returnedfalsein every dialect. It will be removed.If this dialect supports specifying lock timeouts, are those timeouts rendered into theSQLstring as parameters? The implication is that Hibernate will need to bind the timeout value as a parameter in thePreparedStatement. If true, the parameter position is always handled as the last parameter; if the dialect specifies the lock timeout elsewhere in theSQLstatement 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
SQLstring as a parameter; false otherwise.
-
getLockingStrategy
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode)
ALockingStrategywhich is able to acquire a database-level lock with the specified level.- 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 a set ofLockOptions(lock level, timeout), determine the appropriatefor updatefragment to use to obtain the lock.- Parameters:
lockOptions- contains the lock mode to apply.- Returns:
- The appropriate
for updatefragment.
-
getForUpdateString
public String getForUpdateString(LockMode lockMode)
Given aLockMode, determine the appropriatefor updatefragment to use to obtain the lock.- Parameters:
lockMode- The lock mode to apply.- Returns:
- The appropriate for update fragment.
-
getForUpdateString
public String getForUpdateString()
Get the string to append toSELECTstatements to acquire pessimistic UPGRADE locks for this dialect.- Returns:
- The appropriate
FOR UPDATEclause string.
-
getWriteLockString
public String getWriteLockString(int timeout)
Get the string to append toSELECTstatements to acquire pessimistic 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
LOCKclause string.
-
getWriteLockString
public String getWriteLockString(String aliases, int timeout)
Get the string to append toSELECTstatements to acquire WRITE locks for this dialect, given the aliases of the columns to be write 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
LOCKclause string.
-
getReadLockString
public String getReadLockString(int timeout)
Get the string to append toSELECTstatements 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
LOCKclause string.
-
getReadLockString
public String getReadLockString(String aliases, int timeout)
Get the string to append toSELECTstatements 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
LOCKclause 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 UPDATEin 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_listfragment 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_listclause string.
-
getForUpdateString
public String getForUpdateString(String aliases, LockOptions lockOptions)
Get theFOR UPDATE OForFOR SHARE OFfragment 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_listclause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString()
Retrieves theFOR UPDATE NOWAITsyntax specific to this dialect.- Returns:
- The appropriate
FOR UPDATE NOWAITclause string.
-
getForUpdateSkipLockedString
public String getForUpdateSkipLockedString()
Retrieves theFOR UPDATE SKIP LOCKEDsyntax specific to this dialect.- Returns:
- The appropriate
FOR UPDATE SKIP LOCKEDclause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString(String aliases)
Get theFOR UPDATE OF column_list NOWAITfragment 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 NOWAITclause string.
-
getForUpdateSkipLockedString
public String getForUpdateSkipLockedString(String aliases)
Get theFOR UPDATE OF column_list SKIP LOCKEDfragment 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 LOCKEDclause 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 thefromclause.- 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, applying the appropriate updates for the specified lock modes and key columns.This allows emulation of
SELECT FOR UPDATEfor dialects which do not support the standard syntax.- 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.
-
getTimeoutInSeconds
protected int getTimeoutInSeconds(int millis)
-
getCreateTableString
public String getCreateTableString()
The command used to create a table, usuallycreate table.- Returns:
- The command used to create a table.
-
getTableTypeString
public String getTableTypeString()
An arbitrary fragment appended to the end of thecreate tablestatement.- API Note:
- An example is the MySQL
engineoption specifying a storage engine.
-
supportsIfExistsBeforeTableName
public boolean supportsIfExistsBeforeTableName()
For dropping a table, can the phraseif existsbe applied before the table name?- Returns:
trueifif existscan be applied before the table name- API Note:
- Only one or the other (or neither) of this and
supportsIfExistsAfterTableName()should return true.
-
supportsIfExistsAfterTableName
public boolean supportsIfExistsAfterTableName()
For dropping a table, can the phraseif existsbe applied after the table name?- Returns:
trueifif existscan be applied after the table name- API Note:
- Only one or the other (or neither) of this and
supportsIfExistsBeforeTableName()should return true.
-
getBeforeDropStatement
public String getBeforeDropStatement()
A command to execute before dropping tables.- Returns:
- A SQL statement, or
null
-
getDropTableString
@Deprecated(since="6.6") public String getDropTableString(String tableName)
Deprecated.No longer usedThe command used to drop a table with the given name, usuallydrop table tab_name.- Parameters:
tableName- The name of the table to drop- Returns:
- The
drop tablestatement as a string - See Also:
StandardTableExporter.getSqlDropStrings(org.hibernate.mapping.Table, org.hibernate.boot.Metadata, org.hibernate.boot.model.relational.SqlStringGenerationContext)
-
getCreateIndexString
public String getCreateIndexString(boolean unique)
The command used to create an index, usuallycreate indexorcreate unique index.- Parameters:
unique-trueif the index is a unique index- Returns:
- The command used to create an index.
-
getCreateIndexTail
public String getCreateIndexTail(boolean unique, List<Column> columns)
A string to be appended to the end of thecreate indexcommand, usually to specify thatnullvalues are to be considered distinct.
-
qualifyIndexName
public boolean qualifyIndexName()
Do we need to qualify index names with the schema name?- Returns:
trueif we do
-
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.- Returns:
- The command used to create a multiset table.
- API Note:
- Most databases do not have this distinction; this method was originally added for Teradata which does.
-
hasAlterTable
public boolean hasAlterTable()
Does this dialect support theALTER TABLEsyntax?- Returns:
- True if we support altering existing tables; false otherwise.
-
getAlterTableString
public String getAlterTableString(String tableName)
The command used to alter a table with the given name, usuallyalter table tab_nameoralter table tab_name if exists.We prefer the
if existsform if supported.- Parameters:
tableName- The name of the table to alter- Returns:
- The command used to alter a table.
- Since:
- 5.2.11
-
supportsIfExistsAfterAlterTable
public boolean supportsIfExistsAfterAlterTable()
For analter table, can the phraseif existsbe applied?- Returns:
trueifif existscan be applied afteralter table- Since:
- 5.2.11
-
getAddColumnString
public String getAddColumnString()
The subcommand of thealter tablecommand used to add a column to a table, usuallyadd columnoradd.- Returns:
- The
add columnfragment.
-
getAddColumnSuffixString
public String getAddColumnSuffixString()
The syntax for the suffix used to add a column to a table.- Returns:
- The suffix of the
add columnfragment.
-
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.
-
getDropForeignKeyString
public String getDropForeignKeyString()
The subcommand of thealter tablecommand used to drop a foreign key constraint, usuallydrop constraint.
-
getDropUniqueKeyString
public String getDropUniqueKeyString()
The subcommand of thealter tablecommand used to drop a unique key constraint.
-
supportsIfExistsBeforeConstraintName
public boolean supportsIfExistsBeforeConstraintName()
For dropping a constraint with analter tablestatement, can the phraseif existsbe applied before the constraint name?- Returns:
trueifif existscan be applied before the constraint name- API Note:
- Only one or the other (or neither) of this and
supportsIfExistsAfterConstraintName()should return true
-
supportsIfExistsAfterConstraintName
public boolean supportsIfExistsAfterConstraintName()
For dropping a constraint with analter table, can the phraseif existsbe applied after the constraint name?- Returns:
trueifif existscan be applied after the constraint name- API Note:
- Only one or the other (or neither) of this and
supportsIfExistsBeforeConstraintName()should return true.
-
supportsAlterColumnType
public boolean supportsAlterColumnType()
Does this dialect support modifying the type of an existing column?
-
getAlterColumnTypeString
public String getAlterColumnTypeString(String columnName, String columnType, String columnDefinition)
The fragment of analter tablecommand which modifies a column type, or null if column types cannot be modified. Oftenalter column col_name set data type col_type.- Parameters:
columnName- the name of the columncolumnType- the new type of the columncolumnDefinition- the full column definition- Returns:
- a fragment to be appended to
alter table
-
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, with the referenced key columns explicitly specified.- Parameters:
constraintName- The foreign key constraint nameforeignKey- The names of the columns comprising the foreign keyreferencedTable- The table referenced by the foreign keyprimaryKey- The explicit columns in the referencedTable referenced by this foreign key.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)
The syntax used to add a foreign key constraint to a table, given the definition of the foreign key as a string.- Parameters:
constraintName- The foreign key constraint nameforeignKeyDefinition- The whole definition of the foreign key as a fragment
-
useCrossReferenceForeignKeys
public boolean useCrossReferenceForeignKeys()
Does the dialect also need cross-references to get a complete list of foreign keys?
-
getCrossReferenceParentTableFilter
public String getCrossReferenceParentTableFilter()
Some dialects require a not null primaryTable filter. Sometimes a wildcard entry is sufficient for the like condition.- Returns:
-
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
-
getFallbackSqmMutationStrategy
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
TheSqmMultiTableMutationStrategyto use when not specified byQueryEngineOptions.getCustomSqmMultiTableMutationStrategy().
-
getFallbackSqmInsertStrategy
public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy(EntityMappingType entityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
TheSqmMultiTableInsertStrategyto use when not specified byQueryEngineOptions.getCustomSqmMultiTableInsertStrategy().
-
getCreateUserDefinedTypeKindString
public String getCreateUserDefinedTypeKindString()
The kind of user-defined type to create, or the empty string if this does not need to be specified. Included aftercreate type type_name as, but before the list of members.
-
getCreateUserDefinedTypeExtensionsString
public String getCreateUserDefinedTypeExtensionsString()
An arbitrary extension to append to the end of the UDTcreate typecommand.
-
supportsIfExistsBeforeTypeName
public boolean supportsIfExistsBeforeTypeName()
For dropping a type, can the phraseif existsbe applied before the type name?- Returns:
trueifif existscan be applied before the type name- API Note:
- Only one or the other (or neither) of this and
supportsIfExistsAfterTypeName()should return true.
-
supportsIfExistsAfterTypeName
public boolean supportsIfExistsAfterTypeName()
For dropping a type, can the phraseif existsbe applied after the type name?- Returns:
trueifif existscan be applied after the type name- API Note:
- Only one or the other (or neither) of this and
supportsIfExistsBeforeTypeName()should return true.
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, int position) throws SQLException
Registers a parameter capable of returning aResultSetby position, either anOUTparameter, or aREF_CURSORparameter as defined in Java 8.- 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.- API Note:
- Before Java 8, support for
ResultSet-returning parameters was very uneven across database and drivers, leading to its inclusion as part of theDialectcontract.
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, String name) throws SQLException
Registers a parameter capable of returning aResultSetby name, either anOUTparameter, or aREF_CURSORparameter as defined in Java 8.- 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.- API Note:
- Before Java 8, support for
ResultSet-returning parameters was very uneven across database and drivers, leading to its inclusion as part of theDialectcontract.
-
getResultSet
public ResultSet getResultSet(CallableStatement statement) throws SQLException
Given a callable statement previously processed byregisterResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom theOUTparameter.- 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 theResultSetfrom the positionalOUTparameter.- 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 theResultSetfrom the namedOUTparameter.- 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 some way to retrieve the current timestamp value from the database?- Returns:
- True if the current timestamp can be retrieved; false otherwise.
-
isCurrentTimestampSelectStringCallable
public boolean isCurrentTimestampSelectStringCallable()
Is the command returned bygetCurrentTimestampSelectString()treated as callable?Typically, this indicates the use of the JDBC escape syntax.
- Returns:
- if the
getCurrentTimestampSelectString()is treated as callable; false otherwise.
-
getCurrentTimestampSelectString
public String getCurrentTimestampSelectString()
The command used to retrieve the current timestamp from the database.
-
supportsStandardCurrentTimestampFunction
public boolean supportsStandardCurrentTimestampFunction()
Does this dialect have an ANSI SQLcurrent_timestampfunction?
-
buildSQLExceptionConversionDelegate
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
An instance ofSQLExceptionConversionDelegatefor interpreting dialect-specific error or SQLState codes.If this method is overridden to return a non-null value, the default
SQLExceptionConverterwill use the returnedSQLExceptionConversionDelegatein addition to the following standard delegates:- a "static" delegate based on the JDBC4-defined
SQLExceptionhierarchy, and - a delegate that interprets SQLState codes as either X/Open or SQL-2003 codes, depending on what is reported by the JDBC driver.
It is strongly recommended that every
Dialectimplementation override this method, since interpretation of a SQL error is much more accurate when based on the vendor-specific error code, rather than on the SQLState.- Returns:
- The
SQLExceptionConversionDelegatefor this dialect
- a "static" delegate based on the JDBC4-defined
-
getViolatedConstraintNameExtractor
public ViolatedConstraintNameExtractor getViolatedConstraintNameExtractor()
AViolatedConstraintNameExtractorfor extracting the name of a violated constraint from aSQLException.- Specified by:
getViolatedConstraintNameExtractorin interfaceConversionContext
-
getSelectClauseNullString
public String getSelectClauseNullString(int sqlType, TypeConfiguration typeConfiguration)
Given a JDBC type code, return the expression for a literal null value of that type, to use in aselectclause.The
selectquery will be an element of aUNIONorUNION ALL.- Parameters:
sqlType- TheTypestype code.typeConfiguration- The type configuration- Returns:
- The appropriate select clause value fragment.
- Implementation Note:
- Some databases require an explicit type cast.
-
supportsUnionAll
public boolean supportsUnionAll()
Does this dialect supportUNION ALL?- Returns:
- True if
UNION ALLis supported; false otherwise.
-
supportsUnionInSubquery
public boolean supportsUnionInSubquery()
Does this dialect supportUNIONin a subquery.- Returns:
- True if
UNIONis supported in a subquery; false otherwise.
-
getNoColumnsInsertString
@Deprecated(since="6") public String getNoColumnsInsertString()
Deprecated.Override the methodrenderInsertIntoNoColumns()on thetranslatorreturned by this dialect.The fragment used to insert a row without specifying any column values, usually just(), but sometimesdefault values.- Returns:
- The appropriate empty values clause.
- Implementation Note:
- On the other hand, this is simply not possible on some databases!
-
supportsNoColumnsInsert
public boolean supportsNoColumnsInsert()
Is theINSERTstatement is allowed to contain no columns?- Returns:
- if this dialect supports no-column
INSERT.
-
getLowercaseFunction
public String getLowercaseFunction()
The name of the SQL function that transforms a string to lowercase, almost alwayslower.- Returns:
- The dialect-specific lowercase function.
-
getCaseInsensitiveLike
public String getCaseInsensitiveLike()
The name of the SQL operator that performs case-insensitiveLIKEcomparisons.- Returns:
- The dialect-specific case-insensitive like operator.
-
supportsCaseInsensitiveLike
public boolean supportsCaseInsensitiveLike()
Does this dialect support case-insensitiveLIKEcomparisons?- Returns:
trueif the database supports case-insensitive like comparisons,falseotherwise. The default isfalse.
-
supportsTruncateWithCast
public boolean supportsTruncateWithCast()
Does this dialect support truncation of values to a specified length via acast?- Returns:
trueif the database supports truncation via a cast,falseotherwise. The default istrue.
-
supportsIsTrue
public boolean supportsIsTrue()
Does this dialect support theis trueandis falseoperators?- Returns:
trueif the database supportsis trueandis false, orfalseif it does not. The default isis false.
-
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?- Returns:
- The maximum length.
- Implementation Note:
- 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 an identifier generated to the length specified here; so be sure to leave some room (generally speaking 5 positions will suffice).
-
getMaxIdentifierLength
public int getMaxIdentifierLength()
What is the maximum identifier length supported by this dialect?- Returns:
- The maximum length.
-
toBooleanValueString
public String toBooleanValueString(boolean bool)
The SQL literal expression representing the given boolean value.- Parameters:
bool- The boolean value- Returns:
- The appropriate SQL literal.
-
appendBooleanValueString
public void appendBooleanValueString(SqlAppender appender, boolean bool)
Append the SQL literal expression representing the given boolean value to the givenSqlAppender.- Parameters:
bool- The boolean valueappender- TheSqlAppenderto append the literal expression to
-
registerKeyword
protected void registerKeyword(String word)
Register a keyword.- Parameters:
word- a reserved word in this SQL dialect
-
buildIdentifierHelper
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, @Nullable DatabaseMetaData dbMetaData) throws SQLException
TheIdentifierHelperindicated by this dialect for handling identifier conversions. Returningnullis allowed and indicates that Hibernate should fall back to building a "standard" helper. In the fallback path, any changes made to the IdentifierHelperBuilder during this call will still be incorporated into the built IdentifierHelper.The incoming builder will have the following set:
IdentifierHelperBuilder.isGloballyQuoteIdentifiers()IdentifierHelperBuilder.getUnquotedCaseStrategy()- initialized to UPPERIdentifierHelperBuilder.getQuotedCaseStrategy()- initialized to MIXED
By default, Hibernate will do the following:
- Call
IdentifierHelperBuilder.applyIdentifierCasing(DatabaseMetaData) - Call
IdentifierHelperBuilder.applyReservedWords(DatabaseMetaData) - Applies
AnsiSqlKeywords.sql2003()as reserved words - Applies the {#link #sqlKeywords} collected here as reserved words
- Applies the Dialect's
NameQualifierSupport, if it defines one
- Parameters:
builder- A partially-configuredIdentifierHelperBuilder.dbMetaData- Access to the metadata returned from the driver if needed and if available. WARNING: it may benull.- Returns:
- The
IdentifierHelperinstance to use, ornullto indicate Hibernate should use its fallback path - Throws:
SQLException- Accessing theDatabaseMetaDatacan throw it. Just rethrow and Hibernate will handle it.- See Also:
getNameQualifierSupport()
-
openQuote
public char openQuote()
The character specific to this dialect used to begin a quoted identifier.- Returns:
- The dialect-specific open quote character.
-
closeQuote
public char closeQuote()
The character specific to this dialect used to close a quoted identifier.- Returns:
- The dialect-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 String quote(String name)
Apply dialect-specific quoting if the given name is quoted using backticks.By default, the incoming name is checked to see if its first character is a backtick (
`). If it is, the dialect specific quoting is applied.- Parameters:
name- The value to be quoted.- Returns:
- The quoted (or unmodified, if not starting with backtick) value.
- See Also:
openQuote(),closeQuote()
-
getFallbackSchemaManagementTool
@Incubating public SchemaManagementTool getFallbackSchemaManagementTool(Map<String,Object> configurationValues, ServiceRegistryImplementor registry)
TheSchemaManagementToolto use if none is explicitly specified.- Returns:
- a
HibernateSchemaManagementToolby default - API Note:
- Allows implementations to override how schema tooling works by default
-
getTableMigrator
public org.hibernate.tool.schema.internal.TableMigrator getTableMigrator()
Get aTableMigrator, usuallyStandardTableMigrator.
-
getTableCleaner
public Cleaner getTableCleaner()
Get a schemaCleaner, usuallyStandardTableCleaner.
-
getUserDefinedTypeExporter
public Exporter<UserDefinedType> getUserDefinedTypeExporter()
-
getForeignKeyExporter
public Exporter<ForeignKey> getForeignKeyExporter()
-
getUniqueKeyExporter
public Exporter<Constraint> getUniqueKeyExporter()
-
getAuxiliaryDatabaseObjectExporter
public Exporter<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectExporter()
-
getTemporaryTableExporter
public TemporaryTableExporter getTemporaryTableExporter()
Get aTemporaryTableExporter, usuallyStandardTemporaryTableExporter.
-
getSupportedTemporaryTableKind
public TemporaryTableKind getSupportedTemporaryTableKind()
The kind of temporary tables that are supported on this database.
-
getTemporaryTableCreateOptions
public String getTemporaryTableCreateOptions()
An arbitrary SQL fragment appended to the end of the statement to create a temporary table, specifying dialect-specific options, ornullif there are no options to specify.
-
getTemporaryTableCreateCommand
public String getTemporaryTableCreateCommand()
The command to create a temporary table.
-
getTemporaryTableDropCommand
public String getTemporaryTableDropCommand()
The command to drop a temporary table.
-
getTemporaryTableTruncateCommand
public String getTemporaryTableTruncateCommand()
The command to truncate a temporary table.
-
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, for example,
COLLATE DATABASE_DEFAULTin SQL Server
-
getTemporaryTableDdlTransactionHandling
public TempTableDdlTransactionHandling getTemporaryTableDdlTransactionHandling()
The sort of transaction handling to use when creating or dropping temporary tables.
-
getTemporaryTableAfterUseAction
public org.hibernate.query.sqm.mutation.internal.temptable.AfterUseAction getTemporaryTableAfterUseAction()
The action to take after finishing use of a temporary table.
-
getTemporaryTableBeforeUseAction
public org.hibernate.query.sqm.mutation.internal.temptable.BeforeUseAction getTemporaryTableBeforeUseAction()
The action to take before beginning use of a temporary table.
-
canCreateCatalog
public boolean canCreateCatalog()
Does this dialect support creating and dropping catalogs?- 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 creating and dropping schema?- 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 with
getSchemaNameResolver(), unless the resultingSchemaNameResolverdoes not need this information. For example, a custom implementation might make use of the Java 1.7Connection.getSchema()method.- Returns:
- The current schema retrieval SQL
-
getSchemaNameResolver
public SchemaNameResolver getSchemaNameResolver()
Get the strategy for determining the schema name from a JDBCConnection, usuallyDefaultSchemaNameResolver.- Returns:
- The schema name resolver strategy
-
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:
trueif the database/driver has this bug- Implementation Note:
- The main culprit is MySQL.
-
getNullColumnString
public String getNullColumnString()
The keyword used to specify a nullable column, usually"", but sometimes" null".
-
getNullColumnString
public String getNullColumnString(String columnType)
The keyword used to specify a nullable column of the given SQL type.- Implementation Note:
- The culprit is
timestampcolumns on MySQL.
-
quoteCollation
public String quoteCollation(String collation)
Quote the given collation name if necessary.
-
supportsCommentOn
public boolean supportsCommentOn()
Does this dialect support commenting on tables and columns?- Returns:
trueif 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
-
supportsColumnCheck
public boolean supportsColumnCheck()
Does this dialect support column-level check constraints?- Returns:
- True if column-level
checkconstraints are supported; false otherwise.
-
supportsTableCheck
public boolean supportsTableCheck()
Does this dialect support table-level check constraints?- Returns:
- True if table-level
checkconstraints are supported; false otherwise.
-
supportsCascadeDelete
public boolean supportsCascadeDelete()
Does this dialect supporton deleteactions in foreign key definitions?- Returns:
trueif the dialect does support theon deleteclause.
-
getCascadeConstraintsString
public String getCascadeConstraintsString()
The keyword that specifies that adrop tableoperation 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()
AColumnAliasExtractor, usually justResultSetMetaData.getColumnLabel(int).
-
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
-
useConnectionToCreateLob
public boolean useConnectionToCreateLob()
Should BLOB, CLOB, and NCLOB be created solely using respectivelyConnection.createBlob(),Connection.createClob(), andConnection.createNClob().- Returns:
- True if BLOB, CLOB, and NCLOB should be created using JDBC
Connection. - Since:
- 6.6
-
supportsParametersInInsertSelect
@Deprecated(since="6", forRemoval=true) public boolean supportsParametersInInsertSelect()
Deprecated, for removal: This API element is subject to removal in a future version.This seems to be supported on all platforms, and we don't call this except in test suiteDoes this dialect support parameters within theSELECTclause 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 default ordering of null.- Since:
- 6.0.0
-
supportsNullPrecedence
public boolean supportsNullPrecedence()
Does this dialect supportnulls firstandnulls last?
-
isAnsiNullOn
@Deprecated(since="6") public boolean isAnsiNullOn()
Deprecated.This is only called fromSybaseASESqlAstTranslatorso it doesn't need to be declared here.A setting specific toSybaseASEDialect.
-
requiresCastForConcatenatingNonStrings
public boolean requiresCastForConcatenatingNonStrings()
Does this dialect/database require casting of non-string arguments in theconcat()function?- Returns:
trueif casting usingcast()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 - Implementation Note:
- The culprit is HSQLDB.
-
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 use
ResultSet.isAfterLast()andResultSet.isBeforeFirst(). Certain drivers do not allow access to these methods for forward-only cursors.- Returns:
- True if methods like
ResultSet.isAfterLast()andResultSet.isBeforeFirst()are supported for forward only cursors; false otherwise. - Since:
- 3.2
- API Note:
- This is highly driver dependent!
-
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()
Is a subselect supported as the left-hand side (LHS) of anINpredicates?In other words, is syntax like
<subquery> IN (1, 2, 3)supported?- Returns:
- True if a subselect 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.- 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
- Implementation Note:
- 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 v ersions of their driver.
-
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).
- Returns:
- True if the changes are propagated back to the database; false otherwise.
- Since:
- 3.2
- Implementation 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().
- For BLOBs, the internal value might be changed by:
-
supportsUnboundedLobLocatorMaterialization
public boolean supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in which it was created?- Returns:
- True if unbounded materialization is supported; false otherwise.
- Since:
- 3.2
- Implementation Note:
- Again, part of the trickiness here is the fact that this is
largely driver-dependent. All database I have tested which
supportsExpectedLobUsagePattern()also support the ability to materialize a LOB outside the owning transaction.
-
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_COMMITTEDisolation 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_READisolation 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
trueif the database supports accepting bind params as args,falseotherwise. 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 parentheses?- 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 parentheses?- Returns:
- boolean
-
getInExpressionCountLimit
public int getInExpressionCountLimit()
Return the limit that the underlying database places on the number of elements in anINpredicate. If the database defines no such limits, simply return zero or a number smaller than zero.- Returns:
- The limit, or a non-positive integer to indicate no limit.
-
getParameterCountLimit
public int getParameterCountLimit()
Return the limit that the underlying database places on the number of parameters that can be defined for a PreparedStatement. If the database defines no such limits, simply return zero or a number smaller than zero. By default, Dialect returns the same value asgetInExpressionCountLimit().- Returns:
- The limit, or a non-positive integer to indicate no limit.
-
forceLobAsLastValue
public boolean forceLobAsLastValue()
Must LOB values occur last in inserts and updates?- Returns:
- boolean True if Lob values should be last, false if it does not matter.
- Implementation Note:
- Oracle is the culprit here, see HHH-4635.
-
isEmptyStringTreatedAsNull
public boolean isEmptyStringTreatedAsNull()
Return whether the dialect considers an empty string value to be null.- Returns:
- boolean True if an empty string is treated as null, false otherwise.
- Implementation Note:
- Once again, the culprit is Oracle.
-
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:
trueindicates 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 theUniqueDelegatesupported by this dialect- Returns:
- The UniqueDelegate
-
getQueryHintString
public String getQueryHintString(String query, List<String> hintList)
Apply a hint to the given SQL query.The entire query is provided, allowing full control over the placement and syntax of the hint.
By default, ignore the hint and simply return the query.
- 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 given SQL query.The entire query is provided, allowing full control over the placement and syntax of the hint.
By default, ignore the hint and simply return the query.
- Parameters:
query- The query to which to apply the hint.hints- The hints to apply- Returns:
- The modified SQL
-
defaultScrollMode
public ScrollMode defaultScrollMode()
A defaultScrollModeto be used byQuery.scroll().- Returns:
- the default
ScrollModeto use. - API Note:
- Certain dialects support a subset of
ScrollModes.
-
supportsOffsetInSubquery
public boolean supportsOffsetInSubquery()
Does this dialect supportoffsetin subqueries?For example:
select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1 offset 1)
- Returns:
trueif it does
-
supportsOrderByInSubquery
public boolean supportsOrderByInSubquery()
Does this dialect support theorder byclause in subqueries?For example:
select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1)
- Returns:
trueif it does
-
supportsSubqueryInSelect
public boolean supportsSubqueryInSelect()
Does this dialect support subqueries in theselectclause?For example:
select col1, (select col2 from Table2 where ...) from Table1
- Returns:
trueif it does
-
supportsInsertReturning
public boolean supportsInsertReturning()
Does this dialect fully support returning arbitrary generated column values after execution of aninsertstatement, using native SQL syntax?Support for identity columns is insufficient here, we require something like:
insert ... returning ...select from final table (insert ... )
- Returns:
trueifInsertReturningDelegateworks for any sort of primary key column (not just identity columns), orfalseifInsertReturningDelegatedoes not work, or only works for specialized identity/"autoincrement" columns- Since:
- 6.2
- See Also:
InsertReturningDelegate
-
supportsInsertReturningRowId
public boolean supportsInsertReturningRowId()
Does this dialect supports returning theRowIdcolumn after execution of aninsertstatement, using native SQL syntax?- Returns:
trueis the dialect supports returning the rowid column- Since:
- 6.5
- See Also:
supportsInsertReturning()
-
supportsUpdateReturning
public boolean supportsUpdateReturning()
Does this dialect fully support returning arbitrary generated column values after execution of anupdatestatement, using native SQL syntax?Defaults to the value of
supportsInsertReturning()but can be overridden to explicitly disable this for updates.- Since:
- 6.5
- See Also:
supportsInsertReturning()
-
supportsInsertReturningGeneratedKeys
public boolean supportsInsertReturningGeneratedKeys()
Does this dialect fully support returning arbitrary generated column values after execution of aninsertstatement, 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:
trueifGetGeneratedKeysDelegateworks for any sort of primary key column (not just identity columns), orfalseifGetGeneratedKeysDelegatedoes not work, or only works for specialized identity/"autoincrement" columns- Since:
- 6.2
- See Also:
OnExecutionGenerator.getGeneratedIdentifierDelegate(org.hibernate.id.PostInsertIdentityPersister),GetGeneratedKeysDelegate
-
unquoteGetGeneratedKeys
public boolean unquoteGetGeneratedKeys()
Does this dialect require unquoting identifiers when passing them to theConnection.prepareStatement(String, String[])JDBC method.- See Also:
supportsInsertReturningGeneratedKeys()
-
supportsFetchClause
public boolean supportsFetchClause(FetchClauseType type)
Does this dialect support the givenFETCHclause type.- Parameters:
type- The fetch clause type- Returns:
trueif the underlying database supports the given fetch clause type,falseotherwise. The default isfalse.
-
supportsWindowFunctions
public boolean supportsWindowFunctions()
Does this dialect support window functions likerow_number() over (..)?- Returns:
trueif the underlying database supports window functions,falseotherwise. The default isfalse.
-
supportsLateral
public boolean supportsLateral()
Does this dialect support the SQLlateralkeyword or a proprietary alternative?- Returns:
trueif the underlying database supports lateral,falseotherwise. The default isfalse.
-
getCallableStatementSupport
public CallableStatementSupport getCallableStatementSupport()
TheCallableStatementSupportfor this database. Does this database support returning cursors?
-
getNameQualifierSupport
public NameQualifierSupport getNameQualifierSupport()
The support for qualified identifiers.By default, decide based on
DatabaseMetaData.- Returns:
- The
NameQualifierSupport, or null to useDatabaseMetaData.
-
getMultiKeyLoadSizingStrategy
public MultiKeyLoadSizingStrategy getMultiKeyLoadSizingStrategy()
The strategy used to determine the appropriate number of keys to load in a single SQL query with multi-key loading.
-
getBatchLoadSizingStrategy
public MultiKeyLoadSizingStrategy getBatchLoadSizingStrategy()
The strategy used to determine the appropriate number of keys to load in a single SQL query with batch-fetch loading.- See Also:
BatchSize- Implementation Note:
- By default, the same as getMultiKeyLoadSizingStrategy()
-
isJdbcLogWarningsEnabledByDefault
public boolean isJdbcLogWarningsEnabledByDefault()
Is JDBC statement warning logging enabled by default?- Since:
- 5.1
-
supportsPartitionBy
public boolean supportsPartitionBy()
Does is dialect supportpartition by?- Since:
- 5.2
-
supportsNamedParameters
public boolean supportsNamedParameters(@Nullable DatabaseMetaData databaseMetaData) throws SQLException
- Throws:
SQLException- Accessing theDatabaseMetaDatacause an exception. Just rethrow and Hibernate will handle it.
-
getNationalizationSupport
public NationalizationSupport getNationalizationSupport()
Determines whether this database requires the use of explicitly nationalized character (Unicode) data types.That is, whether the use of
Types.NCHAR,Types.NVARCHAR, andTypes.NCLOBis required for nationalized character data.
-
supportsNationalizedMethods
public boolean supportsNationalizedMethods()
Checks whether the JDBC driver implements methods for handling nationalized character data typesResultSet.getNString(int)/PreparedStatement.setNString(int, String),ResultSet.getNClob(int)/PreparedStatement.setNClob(int, NClob),ResultSet.getNCharacterStream(int)/PreparedStatement.setNCharacterStream(int, Reader, long)- Returns:
trueif the driver implements these methods
-
getAggregateSupport
public AggregateSupport getAggregateSupport()
How does this dialect support aggregate types likeSqlTypes.STRUCT.- Since:
- 6.2
-
supportsStandardArrays
public boolean supportsStandardArrays()
Does this database have native support for ANSI SQL standard arrays which are expressed in terms of the element type name:integer array.- Returns:
- boolean
- Since:
- 6.1
- Implementation Note:
- Oracle doesn't have this; we must instead use named array types.
-
useArrayForMultiValuedParameters
public boolean useArrayForMultiValuedParameters()
Does this database prefer to use array types for multi-valued parameters.- Returns:
- boolean
- Since:
- 6.3
-
getArrayTypeName
public String getArrayTypeName(String javaElementTypeName, String elementTypeName, Integer maxLength)
The SQL type name for the array type with elements of the given type name.The ANSI-standard syntax is
integer array.- Since:
- 6.1
-
appendArrayLiteral
public void appendArrayLiteral(SqlAppender appender, Object[] literal, JdbcLiteralFormatter<Object> elementFormatter, WrapperOptions wrapperOptions)
Append an array literal with the given elements to the givenSqlAppender.
-
supportsDistinctFromPredicate
public boolean supportsDistinctFromPredicate()
Does this dialect support some kind ofdistinct frompredicate?That 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 frompredicate; false otherwise - Since:
- 6.1
-
getPreferredSqlTypeCodeForArray
public int getPreferredSqlTypeCodeForArray()
The JDBC type code to use for mapping properties of basic Java array orCollectiontypes.Usually
SqlTypes.ARRAYorSqlTypes.VARBINARY.- Returns:
- one of the type codes defined by
SqlTypes. - Since:
- 6.1
-
getPreferredSqlTypeCodeForBoolean
public int getPreferredSqlTypeCodeForBoolean()
The JDBC type code to use for mapping properties of Java typeboolean.Usually
Types.BOOLEANorTypes.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 (CTEs)?- Returns:
trueif non-query statements are supported with CTE
-
supportsRecursiveCTE
public boolean supportsRecursiveCTE()
Does this dialect/database support recursive CTEs?- Returns:
trueif recursive CTEs are supported- Since:
- 6.2
-
supportsConflictClauseForInsertCTE
public boolean supportsConflictClauseForInsertCTE()
Does this dialect support theconflictclause for insert statements that appear in a CTE?- Returns:
trueifconflictclause is supported- Since:
- 6.5
-
supportsValuesList
public boolean supportsValuesList()
Does this dialect supportvalueslists of formVALUES (1), (2), (3)?- Returns:
trueifvalueslist are supported
-
supportsValuesListForInsert
public boolean supportsValuesListForInsert()
Does this dialect supportvalueslists of formVALUES (1), (2), (3)in insert statements?- Returns:
trueifvalueslist are allowed in insert statements
-
supportsFromClauseInUpdate
public boolean supportsFromClauseInUpdate()
Does this dialect support thefromclause for update statements?- Returns:
trueiffromclause is supported- Since:
- 6.5
-
supportsSkipLocked
public boolean supportsSkipLocked()
Does this dialect supportSKIP_LOCKEDtimeout.- Returns:
trueif SKIP_LOCKED is supported
-
supportsNoWait
public boolean supportsNoWait()
Does this dialect supportNO_WAITtimeout.- Returns:
trueifNO_WAITis supported
-
supportsWait
public boolean supportsWait()
Does this dialect supportWAITtimeout.- Returns:
trueifWAITis supported
-
inlineLiteral
@Deprecated(since="6", forRemoval=true) public String inlineLiteral(String literal)
Deprecated, for removal: This API element is subject to removal in a future version.This is no longer called
-
appendLiteral
public void appendLiteral(SqlAppender appender, String literal)
Append a literal string to the givenSqlAppender.- API Note:
- Needed because MySQL has nonstandard escape characters
-
appendBinaryLiteral
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes)
Append a binary literal to the givenSqlAppender.
-
supportsJdbcConnectionLobCreation
public boolean supportsJdbcConnectionLobCreation(DatabaseMetaData databaseMetaData)
Check whether the JDBCConnectionsupports creating LOBs viaConnection.createBlob(),Connection.createNClob(), orConnection.createClob().- Parameters:
databaseMetaData- JDBCDatabaseMetaDatawhich can be used if LOB creation is supported only starting from a given driver version- Returns:
trueif 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:
trueif LOBs can be set with the materialized APIs.- Since:
- 6.2
-
useMaterializedLobWhenCapacityExceeded
public boolean useMaterializedLobWhenCapacityExceeded()
Whether to switch:- from
VARCHAR-like types toSqlTypes.MATERIALIZED_CLOBtypes when the requested size for a type exceeds thegetMaxVarcharCapacity(), - from
NVARCHAR-like types toSqlTypes.MATERIALIZED_NCLOBtypes when the requested size for a type exceeds thegetMaxNVarcharCapacity(), and - from
VARBINARY-like types toSqlTypes.MATERIALIZED_BLOBtypes when the requested size for a type exceeds thegetMaxVarbinaryCapacity().
- Returns:
trueif materialized LOBs should be used for capacity exceeding types.- Since:
- 6.2
- from
-
addSqlHintOrComment
public String addSqlHintOrComment(String sql, QueryOptions queryOptions, boolean commentsEnabled)
Modify the SQL, adding hints or comments, if necessary
-
prependComment
protected String prependComment(String sql, String comment)
Prepend a comment to the given SQL fragment.
-
escapeComment
public static String escapeComment(String comment)
Perform necessary character escaping on the text of the comment.
-
getHqlTranslator
public HqlTranslator getHqlTranslator()
Return anHqlTranslatorspecific to this dialect, ornullto use the standard translator.Note that
QueryEngineOptions.getCustomHqlTranslator()has higher precedence since it comes directly from the user config.- See Also:
StandardHqlTranslator,QueryEngine.getHqlTranslator()
-
getSqmTranslatorFactory
public SqmTranslatorFactory getSqmTranslatorFactory()
Return aSqmTranslatorFactoryspecific to this dialect, ornullto use the standard translator.Note that
QueryEngineOptions.getCustomSqmTranslatorFactory()has higher precedence since it comes directly from the user config.- See Also:
StandardSqmTranslator,QueryEngine.getSqmTranslatorFactory()
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
-
getGroupBySelectItemReferenceStrategy
public SelectItemReferenceStrategy getGroupBySelectItemReferenceStrategy()
Determine how selected items are referenced in thegroup byclause.
-
getSizeStrategy
public Dialect.SizeStrategy getSizeStrategy()
A customDialect.SizeStrategyfor column types.
-
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 of
text-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 of
ntext-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 of
image-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 of
clob-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 of
nclob-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 of
blob-like type for the column.
-
getDefaultLobLength
public long getDefaultLobLength()
This is the default length for a generated column of typeBLOBorCLOBmapped toBloborClob, if LOB columns have a length in this dialect.- Returns:
- 1048576L by default
- See Also:
Length.LOB_DEFAULT,BlobJavaType,ClobJavaType
-
getDefaultDecimalPrecision
public int getDefaultDecimalPrecision()
This is the default precision for a generated column of exact numeric typeDECIMALorNUMERICmapped to aBigIntegerorBigDecimal.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
- See Also:
BigDecimalJavaType,BigIntegerJavaType
-
getDefaultTimestampPrecision
public int getDefaultTimestampPrecision()
This is the default precision for a generated column of typeTIMESTAMPmapped to aTimestamporLocalDateTime.Usually 6 (microseconds) or 3 (milliseconds).
- Returns:
- the default precision, in decimal digits, of the fractional seconds field
- See Also:
JdbcTimestampJavaType,LocalDateTimeJavaType,OffsetDateTimeJavaType,ZonedDateTimeJavaType,InstantJavaType
-
getDefaultIntervalSecondScale
public int getDefaultIntervalSecondScale()
This is the default scale for a generated column of typeINTERVAL SECONDmapped to aDuration.Usually 9 (nanoseconds) or 6 (microseconds).
- Returns:
- the default scale, in decimal digits, of the fractional seconds field
- See Also:
DurationJavaType
-
doesRoundTemporalOnOverflow
public boolean doesRoundTemporalOnOverflow()
Does this dialect round a temporal when converting from a precision higher to a lower one?- Returns:
- true if rounding is applied, false if truncation is applied
-
getFloatPrecision
public int getFloatPrecision()
This is the default precision for a generated column mapped to a JavaFloatorfloat. 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 JavaDoubleordouble. 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- Implementation Note:
- Getting this right is very important. It
would be great if all platforms supported
datetime arithmetic with nanosecond
precision, since that is how we represent
Duration. But they don't, and we don't want to fill up the SQL expression with many conversions to/from nanoseconds. (Not to mention the problems with numeric overflow that this sometimes causes.) So we need to pick the right value here, and implementtimestampaddPattern(org.hibernate.query.sqm.TemporalUnit, jakarta.persistence.TemporalType, org.hibernate.query.sqm.IntervalType)andtimestampdiffPattern(org.hibernate.query.sqm.TemporalUnit, jakarta.persistence.TemporalType, jakarta.persistence.TemporalType)consistent with our choice.
-
supportsBitType
public boolean supportsBitType()
Does this dialect have a true SQLBITtype with just two values (0 and 1) or, even better, a proper SQLBOOLEANtype, or doesTypes.BITget mapped to a numeric type with more than two values?- Returns:
- true if there is a
BITorBOOLEANtype
-
supportsPredicateAsExpression
protected boolean supportsPredicateAsExpression()
Whether a predicate likea > 0can appear in an expression context, for example, in aselectlist item.
-
getLockRowIdentifier
public RowLockStrategy getLockRowIdentifier(LockMode lockMode)
Obtain aRowLockStrategyfor the givenLockMode.
-
generatedAs
public String generatedAs(String generatedAs)
Thegenerated asclause, or similar, for generated column declarations in DDL statements.- Parameters:
generatedAs- a SQL expression used to generate the column value- Returns:
- The
generated asclause containing the given expression
-
hasDataTypeBeforeGeneratedAs
public boolean hasDataTypeBeforeGeneratedAs()
Is an explicit column type required forgenerated ascolumns?- Returns:
trueif an explicit type is required
-
createOptionalTableUpdateOperation
public MutationOperation createOptionalTableUpdateOperation(EntityMutationTarget mutationTarget, org.hibernate.sql.model.internal.OptionalTableUpdate optionalTableUpdate, SessionFactoryImplementor factory)
Create aMutationOperationfor a updating an optional table
-
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:
trueif 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 tablestatement accept multiple tables?- Returns:
trueif 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
-
getNativeParameterMarkerStrategy
public ParameterMarkerStrategy getNativeParameterMarkerStrategy()
Support for native parameter markers. This is generally dependent on both the database and the driver.- Returns:
- May return
nullto indicate that the JDBC standard strategy should be used
-
supportsBatchUpdates
public Boolean supportsBatchUpdates()
Whether this Dialect supports batch updates.- Returns:
trueindicates it does;falseindicates it does not;nullindicates it might and that database-metadata should be consulted.- See Also:
ExtractedDatabaseMetaData.supportsBatchUpdates()
-
supportsRefCursors
public Boolean supportsRefCursors()
Whether this Dialect supports the JDBCTypes.REF_CURSORtype.- Returns:
trueindicates it does;falseindicates it does not;nullindicates it might and that database-metadata should be consulted- See Also:
ExtractedDatabaseMetaData.supportsRefCursors()
-
appendDatetimeFormat
public void appendDatetimeFormat(SqlAppender appender, String format)
Translate the given datetime format string from the pattern language defined by Java'sDateTimeFormatterto 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
In addition, punctuation characters and single-quoted literal strings are accepted.
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, TemporalType precision, TimeZone jdbcTimeZone)
Append a datetime literal representing the givenjava.timevalue to the givenSqlAppender.
-
appendDateTimeLiteral
public void appendDateTimeLiteral(SqlAppender appender, Date date, TemporalType precision, TimeZone jdbcTimeZone)
Append a datetime literal representing the givenDatevalue to the givenSqlAppender.
-
appendDateTimeLiteral
public void appendDateTimeLiteral(SqlAppender appender, Calendar calendar, TemporalType precision, TimeZone jdbcTimeZone)
Append a datetime literal representing the givenCalendarvalue to the givenSqlAppender.
-
appendIntervalLiteral
public void appendIntervalLiteral(SqlAppender appender, Duration literal)
Append a literal SQLintervalrepresenting the given JavaDuration.
-
appendUUIDLiteral
public void appendUUIDLiteral(SqlAppender appender, UUID literal)
Append a literal SQLuuidrepresenting the given JavaUUID.This is usually a
cast()expression, but it might be a function call.
-
supportsTemporalLiteralOffset
public boolean supportsTemporalLiteralOffset()
Does this dialect supports timezone offsets in temporal literals.
-
getTimeZoneSupport
public TimeZoneSupport getTimeZoneSupport()
How the dialect supports time zone types likeTypes.TIMESTAMP_WITH_TIMEZONE.
-
rowId
public String rowId(String rowId)
The name of arowid-like pseudo-column which acts as a high-performance row locator, or null if this dialect has no such pseudo-column.If the
rowid-like value is an explicitly-declared named column instead of an implicit pseudo-column, and if the given name is nonempty, return the given name.- Parameters:
rowId- the name specified byRowId.value(), which is ignored ifgetRowIdColumnString(java.lang.String)is not overridden
-
rowIdSqlType
public int rowIdSqlType()
The JDBC type code of therowid-like pseudo-column which acts as a high-performance row locator.- Returns:
Types.ROWIDby default
-
getRowIdColumnString
public String getRowIdColumnString(String rowId)
If this dialect requires that therowidcolumn be declared explicitly, return the DDL column definition.- Returns:
- the DDL column definition, or
nullif therowidis an implicit pseudo-column
-
getDmlTargetColumnQualifierSupport
public DmlTargetColumnQualifierSupport getDmlTargetColumnQualifierSupport()
Get the minimumDmlTargetColumnQualifierSupportrequired by this dialect.- Returns:
- the column qualifier support required by this dialect
-
getFunctionalDependencyAnalysisSupport
public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport()
Get this dialect's level of support for primary key functional dependency analysis withinGROUP BYandORDER BYclauses.
-
-