Class OracleDialect
- java.lang.Object
-
- org.hibernate.dialect.Dialect
-
- org.hibernate.dialect.OracleDialect
-
- All Implemented Interfaces:
ConversionContext
- Direct Known Subclasses:
Oracle10gDialect,Oracle12cDialect,Oracle8iDialect,Oracle9iDialect
public class OracleDialect extends Dialect
A SQL dialect for Oracle 11g Release 2 and above.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanautonomousis it an Autonomous Database Cloud Service?static StringPREFER_LONG_RAW-
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description OracleDialect()OracleDialect(DatabaseVersion version)OracleDialect(DialectResolutionInfo info)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendBinaryLiteral(SqlAppender appender, byte[] bytes)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).IdentifierHelperbuildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)Build the IdentifierHelper indicated by this Dialect for handling identifier conversions.SQLExceptionConversionDelegatebuildSQLExceptionConversionDelegate()Build an instance of aSQLExceptionConversionDelegatefor interpreting dialect-specific error or SQLState codes.booleancanCreateSchema()Does this dialect support schema creation?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)Oracle doesn't have any sort ofTypes.BOOLEANtype orTypes.TIMEtype, and its default behavior for casting dates and timestamps to and from strings is just awful.protected StringcolumnType(int sqlTypeCode)voidcontributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)Allows the Dialect to contribute additional typesStringcurrentDate()Translation of the HQL/JPQLcurrent_datefunction, which maps to the Java typejava.sql.Date, and of the HQLlocal_datefunction which maps to the Java typejava.sql.LocalDate.StringcurrentLocalTime()Translation of the HQLlocal_timefunction, which maps to the Java typejava.time.LocalTimewhich is a time with no time zone.StringcurrentLocalTimestamp()Translation of the HQLlocal_datetimefunction, which maps to the Java typejava.time.LocalDateTimewhich is a datetime with no time zone.StringcurrentTime()Translation of the HQL/JPQLcurrent_timefunction, which maps to the Java typejava.sql.Timewhich is a time with no time zone.StringcurrentTimestamp()Translation of the HQL/JPQLcurrent_timestampfunction, which maps to the Java typejava.sql.Timestampwhich is a datetime with no time zone.StringcurrentTimestampWithTimeZone()Translation of the HQLoffset_datetimefunction, which maps to the Java typejava.time.OffsetDateTimewhich is a datetime with a time zone.static ReplacerdatetimeFormat(String format, boolean useFm, boolean resetFm)booleandropConstraints()Do we need to drop constraints before dropping tables in this dialect?StringextractPattern(TemporalUnit unit)Oracle supports a limited list of temporal fields in the extract() function, but we can emulate some of them by using to_char() with a format string instead of extract().booleanforceLobAsLastValue()HHH-4635 Oracle expects all Lob values to be last in inserts and updates.StringgeneratedAs(String generatedAs)Thegenerated asclause, or similar, for generated column declarations in DDL statements.StringgetAddColumnString()The syntax used to add a column to a table (optional).AggregateSupportgetAggregateSupport()How the Dialect supports aggregate types likeSqlTypes.STRUCT.StringgetAlterColumnTypeString(String columnName, String columnType, String columnDefinition)StringgetArrayTypeName(String elementTypeName)The SQL type name for the array of the given type name.CallableStatementSupportgetCallableStatementSupport()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.StringgetCreateUserDefinedTypeKindString()Command used to create a table.StringgetCurrentSchemaCommand()Get the SQL command used to retrieve the current schema name.StringgetCurrentTimestampSelectString()Retrieve the command used to retrieve the current timestamp from the database.intgetDefaultStatementBatchSize()The default value to use for the configuration property "hibernate.jdbc.batch_size".booleangetDefaultUseGetGeneratedKeys()The default value to use for the configuration property "hibernate.jdbc.use_get_generated_keys".StringgetDisableConstraintStatement(String tableName, String name)A SQL statement that temporarily disables checking of the given foreign key constraint.StringgetEnableConstraintStatement(String tableName, String name)A SQL statement that re-enables checking of the given foreign key constraint.SqmMultiTableInsertStrategygetFallbackSqmInsertStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)SqmMultiTableMutationStrategygetFallbackSqmMutationStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)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(String aliases)Get theFOR UPDATE OF column_listfragment appropriate for this dialect given the aliases of the columns to be write locked.longgetFractionalSecondPrecisionInNanos()We minimize multiplicative factors by using seconds (with fractional part) as the "native" precision for duration arithmetic.IdentityColumnSupportgetIdentityColumnSupport()Get the appropriateIdentityColumnSupportintgetInExpressionCountLimit()Return the limit that the underlying database places on the number of elements in anINpredicate.LimitHandlergetLimitHandler()Returns aLimitHandlerthat implements support forQuery.setMaxResults(int)andQuery.setFirstResult(int)for this dialect.intgetMaxAliasLength()What is the maximum length Hibernate can use for generated aliases?intgetMaxIdentifierLength()What is the maximum identifier length supported by the dialect?intgetMaxVarbinaryLength()The biggest size value that can be supplied as argument to aTypes.VARBINARY-like type.intgetMaxVarcharLength()The biggest size value that can be supplied as argument to aTypes.VARCHAR-like type.protected DatabaseVersiongetMinimumSupportedVersion()StringgetNativeIdentifierGeneratorStrategy()Resolves the native generation strategy associated to this dialect.intgetPreferredSqlTypeCodeForArray()The JDBCtype codeto use for mapping properties of basic Java array orCollectiontypes.intgetPreferredSqlTypeCodeForBoolean()The JDBCtype codeto use for mapping properties of Java typeboolean.StringgetQueryHintString(String sql, String hints)Apply a hint to the query.StringgetQuerySequencesString()Get the select command used retrieve the names of all sequences.StringgetReadLockString(int timeout)Get the string to append to SELECT statements to acquire READ locks for this dialect.StringgetReadLockString(String aliases, int timeout)Get the string to append to SELECT statements to acquire READ locks for this dialect given the aliases of the columns to be read locked.ResultSetgetResultSet(CallableStatement ps)Given a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the OUT parameter.ResultSetgetResultSet(CallableStatement statement, int position)Given a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSet.ResultSetgetResultSet(CallableStatement statement, String name)Given a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the OUT parameter.StringgetSelectGUIDString()Get the command used to select a GUID from the underlying database.SequenceInformationExtractorgetSequenceInformationExtractor()A source ofSequenceInformation.SequenceSupportgetSequenceSupport()SqlAstTranslatorFactorygetSqlAstTranslatorFactory()Return aSqlAstTranslatorFactoryspecific to this dialect.TemporaryTableKindgetSupportedTemporaryTableKind()StringgetTemporaryTableCreateOptions()TimeZoneSupportgetTimeZoneSupport()How the Dialect supports time zone types likeTypes.TIMESTAMP_WITH_TIMEZONE.UniqueDelegategetUniqueDelegate()Get theUniqueDelegatesupported by this dialectViolatedConstraintNameExtractorgetViolatedConstraintNameExtractor()StringgetWriteLockString(int timeout)Get the string to append to SELECT statements to acquire WRITE locks for this dialect.StringgetWriteLockString(String aliases, int timeout)Get the string to append to SELECT statements to acquire WRITE locks for this dialect given the aliases of the columns to be write locked.RowLockStrategygetWriteRowLockStrategy()The row lock strategy to use for write locks.protected voidinitDefaultProperties()Set appropriate default values for configuration properties.voidinitializeFunctionRegistry(QueryEngine queryEngine)Initialize the given registry with any dialect-specific functions.booleanisAutonomous()protected static booleanisAutonomous(DatabaseMetaData databaseMetaData)booleanisCurrentTimestampSelectStringCallable()Should the value returned byDialect.getCurrentTimestampSelectString()be treated as callable.booleanisEmptyStringTreatedAsNull()Return whether the dialect considers an empty-string value as null.protected voidregisterColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)Register ANSI-standard column types using the length limits defined byDialect.getMaxVarcharLength(),Dialect.getMaxNVarcharLength(), andDialect.getMaxVarbinaryLength().intregisterResultSetOutParameter(CallableStatement statement, int col)Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet*by position*.intregisterResultSetOutParameter(CallableStatement statement, String name)Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet*by name*.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.booleansupportsAlterColumnType()booleansupportsBitType()Oracle has neitherBITnorBOOLEAN.booleansupportsCommentOn()Does this dialect support commenting on tables and columns?booleansupportsCurrentTimestampSelection()Does this dialect support a way to retrieve the database's current timestamp value?booleansupportsExistsInSelect()Does the dialect support an exists statement in the select clause?booleansupportsFetchClause(FetchClauseType type)Does this dialect support the given fetch clause type.booleansupportsInsertReturningGeneratedKeys()Does this dialect fully support returning arbitrary generated column values after execution of aninsertstatement, using the JDBC methodConnection.prepareStatement(String, String[]).booleansupportsLateral()Does this dialect support the SQLlateralkeyword or a proprietary alternative?booleansupportsNamedParameters(DatabaseMetaData databaseMetaData)Override the DatabaseMetaData#supportsNamedParameters()booleansupportsNoWait()Does this dialect supportNO_WAITtimeout.booleansupportsOffsetInSubquery()Does this dialect supportoffsetin subqueries? For example:select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1 offset 1)booleansupportsPartitionBy()Does the underlying database support partition by?booleansupportsRecursiveCTE()Does this dialect/database support recursive CTEs (Common Table Expressions)?booleansupportsSkipLocked()Does this dialect supportSKIP_LOCKEDtimeout.booleansupportsTupleDistinctCounts()Does this dialect supportcount(distinct a,b)?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.booleanuseFollowOnLocking(String sql, QueryOptions queryOptions)For Oracle, the FOR UPDATE clause cannot be applied when using ORDER BY, DISTINCT or views.-
Methods inherited from class org.hibernate.dialect.Dialect
addSqlHintOrComment, appendArrayLiteral, appendBooleanValueString, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, canBatchTruncate, canCreateCatalog, castType, checkVersion, closeQuote, createUpsertOperation, defaultScrollMode, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, equivalentTypes, escapeComment, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getCaseInsensitiveLike, getCheckCondition, getCheckCondition, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getDefaultBatchLoadSizingStrategy, getDefaultDecimalPrecision, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultProperties, getDefaultTimestampPrecision, getDisableConstraintsStatement, getDoublePrecision, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropTableString, getDropUniqueKeyString, getEnableConstraintsStatement, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFloatPrecision, getForeignKeyExporter, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getGroupBySelectItemReferenceStrategy, getHqlTranslator, getIndexExporter, getKeywords, getLobMergeStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarcharCapacity, getNameQualifierSupport, getNationalizationSupport, getNoColumnsInsertString, getNullColumnString, getNullColumnString, getNullOrdering, getQueryHintString, getReadRowLockStrategy, getSchemaNameResolver, getSelectClauseNullString, getSequenceExporter, getSizeStrategy, getSqmTranslatorFactory, getTableCleaner, getTableComment, getTableExporter, getTableMigrator, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTruncateTableStatement, getTruncateTableStatements, getUniqueKeyExporter, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, inlineLiteral, isAnsiNullOn, isJdbcLogWarningsEnabledByDefault, isLockTimeoutParameterized, openQuote, prependComment, qualifyIndexName, quote, registerDefaultKeywords, registerKeyword, registerKeywords, requiresCastForConcatenatingNonStrings, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeLength, supportsBindAsCallableArgument, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsDistinctFromPredicate, supportsExpectedLobUsagePattern, supportsFractionalTimestampArithmetic, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsIfExistsBeforeTypeName, supportsInsertReturning, supportsJdbcConnectionLobCreation, supportsLobValueChangePropagation, supportsLockTimeouts, supportsMaterializedLobAccess, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsNullPrecedence, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsParametersInInsertSelect, supportsPredicateAsExpression, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTemporalLiteralOffset, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsValuesList, supportsValuesListForInsert, supportsWait, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, translateExtractField, trimPattern, useInputStreamToInsertBlob, useMaterializedLobWhenCapacityExceeded
-
-
-
-
Field Detail
-
PREFER_LONG_RAW
public static final String PREFER_LONG_RAW
- See Also:
- Constant Field Values
-
autonomous
protected final boolean autonomous
is it an Autonomous Database Cloud Service?
-
-
Constructor Detail
-
OracleDialect
public OracleDialect()
-
OracleDialect
public OracleDialect(DatabaseVersion version)
-
OracleDialect
public OracleDialect(DialectResolutionInfo info)
-
-
Method Detail
-
isAutonomous
protected static boolean isAutonomous(DatabaseMetaData databaseMetaData)
-
isAutonomous
public boolean isAutonomous()
-
getMinimumSupportedVersion
protected DatabaseVersion getMinimumSupportedVersion()
- Overrides:
getMinimumSupportedVersionin classDialect
-
getPreferredSqlTypeCodeForBoolean
public int getPreferredSqlTypeCodeForBoolean()
Description copied from class:DialectThe JDBCtype codeto use for mapping properties of Java typeboolean.Usually
Types.BOOLEANorTypes.BIT.- Overrides:
getPreferredSqlTypeCodeForBooleanin classDialect- Returns:
- one of the type codes defined by
Types.
-
initializeFunctionRegistry
public void initializeFunctionRegistry(QueryEngine queryEngine)
Description copied from class:DialectInitialize 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])
-
pi -
log10(arg) -
log(base, arg) -
sign(arg) -
sin(arg) -
cos(arg) -
tan(arg) -
asin(arg) -
acos(arg) -
atan(arg) -
atan2(arg0, arg1) -
round(arg0[, arg1]) -
truncate(arg0[, arg1]) -
sinh(arg) -
tanh(arg) -
cosh(arg) -
least(arg0, arg1, ...) -
greatest(arg0, arg1, ...) -
degrees(arg) -
radians(arg)
-
format(datetime as pattern) -
collate(string as collation) -
str(arg)- synonym ofcast(a as String) -
ifnull(arg0, arg1)- synonym ofcoalesce(a, b)
extract(), and desugared by the parser:-
second(arg)- synonym ofextract(second from a) -
minute(arg)- synonym ofextract(minute from a) -
hour(arg)- synonym ofextract(hour from a) -
day(arg)- synonym ofextract(day from a) -
month(arg)- synonym ofextract(month from a) -
year(arg)- synonym ofextract(year from a)
second()function returns a floating point value, contrary to the integer type returned by the native function with this name on many databases. Thus, we don't just naively map these HQL functions to the native SQL functions with the same names.- Overrides:
initializeFunctionRegistryin classDialect
-
-
getMaxVarcharLength
public int getMaxVarcharLength()
Description copied from class:DialectThe biggest size value that can be supplied as argument to aTypes.VARCHAR-like type. For longer column lengths, use some sort oftext-like type for the column.- Overrides:
getMaxVarcharLengthin classDialect
-
getMaxVarbinaryLength
public int getMaxVarbinaryLength()
Description copied from class:DialectThe biggest size value that can be supplied as argument to aTypes.VARBINARY-like type. For longer column lengths, use some sort ofimage-like type for the column.- Overrides:
getMaxVarbinaryLengthin classDialect
-
getSqlAstTranslatorFactory
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Description copied from class:DialectReturn aSqlAstTranslatorFactoryspecific to this dialect. Returnnullto use Hibernate's standard translator.- Overrides:
getSqlAstTranslatorFactoryin classDialect- See Also:
StandardSqlAstTranslatorFactory,JdbcEnvironment.getSqlAstTranslatorFactory()
-
currentDate
public String currentDate()
Description copied from class:DialectTranslation of the HQL/JPQLcurrent_datefunction, which maps to the Java typejava.sql.Date, and of the HQLlocal_datefunction which maps to the Java typejava.sql.LocalDate.- Overrides:
currentDatein classDialect
-
currentTime
public String currentTime()
Description copied from class:DialectTranslation of the HQL/JPQLcurrent_timefunction, which maps to the Java typejava.sql.Timewhich 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.- Overrides:
currentTimein classDialect
-
currentTimestamp
public String currentTimestamp()
Description copied from class:DialectTranslation of the HQL/JPQLcurrent_timestampfunction, which maps to the Java typejava.sql.Timestampwhich 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.- Overrides:
currentTimestampin classDialect
-
currentLocalTime
public String currentLocalTime()
Description copied from class:DialectTranslation of the HQLlocal_timefunction, which maps to the Java typejava.time.LocalTimewhich is a time with no time zone. It should usually be the same SQL function as forDialect.currentTime().It is recommended to override this in dialects for databases which support
localtimeorcurrent_time at local.- Overrides:
currentLocalTimein classDialect
-
currentLocalTimestamp
public String currentLocalTimestamp()
Description copied from class:DialectTranslation of the HQLlocal_datetimefunction, which maps to the Java typejava.time.LocalDateTimewhich is a datetime with no time zone. It should usually be the same SQL function as forDialect.currentTimestamp().It is recommended to override this in dialects for databases which support
localtimestamporcurrent_timestamp at local.- Overrides:
currentLocalTimestampin classDialect
-
currentTimestampWithTimeZone
public String currentTimestampWithTimeZone()
Description copied from class:DialectTranslation of the HQLoffset_datetimefunction, which maps to the Java typejava.time.OffsetDateTimewhich is a datetime with a time zone. This in principle correctly maps to the ANSI SQLcurrent_timestampwhich has the typeTIMESTAMP WITH TIME ZONE.- Overrides:
currentTimestampWithTimeZonein classDialect
-
supportsInsertReturningGeneratedKeys
public boolean supportsInsertReturningGeneratedKeys()
Description copied from class:DialectDoes 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.- Overrides:
supportsInsertReturningGeneratedKeysin classDialect- Returns:
trueifGetGeneratedKeysDelegateworks for any sort of primary key column (not just identity columns), orfalseifGetGeneratedKeysDelegatedoes not work, or only works for specialized identity/"autoincrement" columns- See Also:
OnExecutionGenerator.getGeneratedIdentifierDelegate(org.hibernate.id.PostInsertIdentityPersister),GetGeneratedKeysDelegate
-
castPattern
public String castPattern(CastType from, CastType to)
Oracle doesn't have any sort ofTypes.BOOLEANtype orTypes.TIMEtype, and its default behavior for casting dates and timestamps to and from strings is just awful.- Overrides:
castPatternin classDialect- Parameters:
from- aCastTypeindicating the type of the value argumentto- aCastTypeindicating the type the value argument is cast to
-
getFractionalSecondPrecisionInNanos
public long getFractionalSecondPrecisionInNanos()
We minimize multiplicative factors by using seconds (with fractional part) as the "native" precision for duration arithmetic.- Overrides:
getFractionalSecondPrecisionInNanosin classDialect- Returns:
- the precision, specified as a quantity of nanoseconds
- See Also:
TemporalUnit.NATIVE
-
extractPattern
public String extractPattern(TemporalUnit unit)
Oracle supports a limited list of temporal fields in the extract() function, but we can emulate some of them by using to_char() with a format string instead of extract().Thus, the additional supported fields are
TemporalUnit.DAY_OF_YEAR,TemporalUnit.DAY_OF_MONTH,TemporalUnit.DAY_OF_YEAR, andTemporalUnit.WEEK.- Overrides:
extractPatternin classDialect- Parameters:
unit- the first argument
-
timestampaddPattern
public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType)
Description copied from class:DialectObtain a pattern for the SQL equivalent to atimestampadd()function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.- Overrides:
timestampaddPatternin classDialect- 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
-
timestampdiffPattern
public String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType)
Description copied from class:DialectObtain a pattern for the SQL equivalent to atimestampdiff()function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.- Overrides:
timestampdiffPatternin classDialect- Parameters:
unit- the first argumentfromTemporalType- true if the first argument is a timestamp, false if a datetoTemporalType- true if the second argument is
-
columnType
protected String columnType(int sqlTypeCode)
Description copied from class:DialectThe 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 toDialect.registerColumnTypes(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.
- Overrides:
columnTypein classDialect- Parameters:
sqlTypeCode- a SQLtype code- Returns:
- a column type name, with $l, $p, $s placeholders for length, precision, scale
- See Also:
SqlTypes
- Implementations of this method are expected to define a
sensible mapping for
-
registerColumnTypes
protected void registerColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Description copied from class:DialectRegister ANSI-standard column types using the length limits defined byDialect.getMaxVarcharLength(),Dialect.getMaxNVarcharLength(), andDialect.getMaxVarbinaryLength().This method is always called when a
Dialectis instantiated.- Overrides:
registerColumnTypesin classDialect
-
getTimeZoneSupport
public TimeZoneSupport getTimeZoneSupport()
Description copied from class:DialectHow the Dialect supports time zone types likeTypes.TIMESTAMP_WITH_TIMEZONE.- Overrides:
getTimeZoneSupportin classDialect
-
initDefaultProperties
protected void initDefaultProperties()
Description copied from class:DialectSet appropriate default values for configuration properties.- Overrides:
initDefaultPropertiesin classDialect
-
getDefaultStatementBatchSize
public int getDefaultStatementBatchSize()
Description copied from class:DialectThe default value to use for the configuration property "hibernate.jdbc.batch_size".- Overrides:
getDefaultStatementBatchSizein classDialect
-
getDefaultUseGetGeneratedKeys
public boolean getDefaultUseGetGeneratedKeys()
Description copied from class:DialectThe default value to use for the configuration property "hibernate.jdbc.use_get_generated_keys".- Overrides:
getDefaultUseGetGeneratedKeysin classDialect
-
resolveSqlTypeDescriptor
public JdbcType resolveSqlTypeDescriptor(String columnTypeName, int jdbcTypeCode, int precision, int scale, JdbcTypeRegistry jdbcTypeRegistry)
Description copied from class:DialectAssigns an appropriateJdbcTypeto a column of a JDBC result set based on the column type name, JDBC type code, precision, and scale.- Overrides:
resolveSqlTypeDescriptorin classDialect- Parameters:
columnTypeName- the column type namejdbcTypeCode- thetype codeprecision- the precision or 0scale- the scale or 0- Returns:
- an appropriate instance of
JdbcType
-
supportsBitType
public boolean supportsBitType()
Oracle has neitherBITnorBOOLEAN.- Overrides:
supportsBitTypein classDialect- Returns:
- false
-
getArrayTypeName
public String getArrayTypeName(String elementTypeName)
Description copied from class:DialectThe SQL type name for the array of the given type name.- Overrides:
getArrayTypeNamein classDialect
-
getPreferredSqlTypeCodeForArray
public int getPreferredSqlTypeCodeForArray()
Description copied from class:DialectThe JDBCtype codeto use for mapping properties of basic Java array orCollectiontypes.Usually
SqlTypes.ARRAYorSqlTypes.VARBINARY.- Overrides:
getPreferredSqlTypeCodeForArrayin classDialect- Returns:
- one of the type codes defined by
SqlTypes.
-
contributeTypes
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Description copied from class:DialectAllows the Dialect to contribute additional types- Overrides:
contributeTypesin classDialect- Parameters:
typeContributions- Callback to contribute the typesserviceRegistry- The service registry
-
getAggregateSupport
public AggregateSupport getAggregateSupport()
Description copied from class:DialectHow the Dialect supports aggregate types likeSqlTypes.STRUCT.- Overrides:
getAggregateSupportin classDialect
-
getNativeIdentifierGeneratorStrategy
public String getNativeIdentifierGeneratorStrategy()
Description copied from class:DialectResolves the native generation strategy associated to this dialect.Comes into play whenever the user specifies the native generator.
- Overrides:
getNativeIdentifierGeneratorStrategyin classDialect- Returns:
- The native generator strategy.
-
getIdentityColumnSupport
public IdentityColumnSupport getIdentityColumnSupport()
Description copied from class:DialectGet the appropriateIdentityColumnSupport- Overrides:
getIdentityColumnSupportin classDialect- Returns:
- the IdentityColumnSupport
-
getLimitHandler
public LimitHandler getLimitHandler()
Description copied from class:DialectReturns aLimitHandlerthat implements support forQuery.setMaxResults(int)andQuery.setFirstResult(int)for this dialect.- Overrides:
getLimitHandlerin classDialect
-
getCurrentTimestampSelectString
public String getCurrentTimestampSelectString()
Description copied from class:DialectRetrieve the command used to retrieve the current timestamp from the database.- Overrides:
getCurrentTimestampSelectStringin classDialect- Returns:
- The command.
-
getAddColumnString
public String getAddColumnString()
Description copied from class:DialectThe syntax used to add a column to a table (optional).- Overrides:
getAddColumnStringin classDialect- Returns:
- The "add column" fragment.
-
getCascadeConstraintsString
public String getCascadeConstraintsString()
Description copied from class:DialectThe 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.- Overrides:
getCascadeConstraintsStringin classDialect- Returns:
- The cascade drop keyword, if any, with a leading space
-
dropConstraints
public boolean dropConstraints()
Description copied from class:DialectDo we need to drop constraints before dropping tables in this dialect?- Overrides:
dropConstraintsin classDialect- Returns:
- True if constraints must be dropped prior to dropping the table; false otherwise.
-
getAlterColumnTypeString
public String getAlterColumnTypeString(String columnName, String columnType, String columnDefinition)
- Overrides:
getAlterColumnTypeStringin classDialect
-
supportsAlterColumnType
public boolean supportsAlterColumnType()
- Overrides:
supportsAlterColumnTypein classDialect
-
getSequenceSupport
public SequenceSupport getSequenceSupport()
- Overrides:
getSequenceSupportin classDialect
-
getQuerySequencesString
public String getQuerySequencesString()
Description copied from class:DialectGet the select command used retrieve the names of all sequences.- Overrides:
getQuerySequencesStringin classDialect- Returns:
- The select command; or null if sequences are not supported.
-
getSequenceInformationExtractor
public SequenceInformationExtractor getSequenceInformationExtractor()
Description copied from class:DialectA source ofSequenceInformation.- Overrides:
getSequenceInformationExtractorin classDialect
-
getSelectGUIDString
public String getSelectGUIDString()
Description copied from class:DialectGet the command used to select a GUID from the underlying database.Optional operation.
- Overrides:
getSelectGUIDStringin classDialect- Returns:
- The appropriate command.
-
getViolatedConstraintNameExtractor
public ViolatedConstraintNameExtractor getViolatedConstraintNameExtractor()
- Specified by:
getViolatedConstraintNameExtractorin interfaceConversionContext- Overrides:
getViolatedConstraintNameExtractorin classDialect
-
buildSQLExceptionConversionDelegate
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
Description copied from class:DialectBuild an instance of aSQLExceptionConversionDelegatefor 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 JDBC 4 defined SQLException hierarchy;
- a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes, depending on java.sql.DatabaseMetaData#getSQLStateType
It is strongly recommended that specific Dialect implementations override this method, since interpretation of a SQL error is much more accurate when based on the vendor-specific ErrorCode rather than the SQLState.
Specific Dialects may override to return whatever is most appropriate for that vendor.
- Overrides:
buildSQLExceptionConversionDelegatein classDialect- Returns:
- The SQLExceptionConversionDelegate for this dialect
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException
Description copied from class:DialectRegisters a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet*by position*. Pre-Java 8, registering such ResultSet-returning parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.- Overrides:
registerResultSetOutParameterin classDialect- Parameters:
statement- The callable statement.col- 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.
-
getResultSet
public ResultSet getResultSet(CallableStatement ps) throws SQLException
Description copied from class:DialectGiven a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the OUT parameter.- Overrides:
getResultSetin classDialect- Parameters:
ps- The callable statement.- Returns:
- The extracted result set.
- Throws:
SQLException- Indicates problems extracting the result set.
-
supportsCommentOn
public boolean supportsCommentOn()
Description copied from class:DialectDoes this dialect support commenting on tables and columns?- Overrides:
supportsCommentOnin classDialect- Returns:
trueif commenting is supported
-
supportsCurrentTimestampSelection
public boolean supportsCurrentTimestampSelection()
Description copied from class:DialectDoes this dialect support a way to retrieve the database's current timestamp value?- Overrides:
supportsCurrentTimestampSelectionin classDialect- Returns:
- True if the current timestamp can be retrieved; false otherwise.
-
isCurrentTimestampSelectStringCallable
public boolean isCurrentTimestampSelectStringCallable()
Description copied from class:DialectShould the value returned byDialect.getCurrentTimestampSelectString()be treated as callable. Typically, this indicates that JDBC escape syntax is being used.- Overrides:
isCurrentTimestampSelectStringCallablein classDialect- Returns:
- True if the
Dialect.getCurrentTimestampSelectString()return is callable; false otherwise.
-
supportsExistsInSelect
public boolean supportsExistsInSelect()
Description copied from class:DialectDoes the dialect support an exists statement in the select clause?- Overrides:
supportsExistsInSelectin classDialect- Returns:
- True if exists checks are allowed in the select clause; false otherwise.
-
getInExpressionCountLimit
public int getInExpressionCountLimit()
Description copied from class:DialectReturn 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 less-than-zero.- Overrides:
getInExpressionCountLimitin classDialect- Returns:
- int The limit, or zero-or-less to indicate no limit.
-
forceLobAsLastValue
public boolean forceLobAsLastValue()
Description copied from class:DialectHHH-4635 Oracle expects all Lob values to be last in inserts and updates.- Overrides:
forceLobAsLastValuein classDialect- Returns:
- boolean True if Lob values should be last, false if it does not matter.
-
isEmptyStringTreatedAsNull
public boolean isEmptyStringTreatedAsNull()
Description copied from class:DialectReturn whether the dialect considers an empty-string value as null.- Overrides:
isEmptyStringTreatedAsNullin classDialect- Returns:
- boolean True if an empty string is treated as null, false otherwise.
-
getFallbackSqmMutationStrategy
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
- Overrides:
getFallbackSqmMutationStrategyin classDialect
-
getFallbackSqmInsertStrategy
public SqmMultiTableInsertStrategy getFallbackSqmInsertStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
- Overrides:
getFallbackSqmInsertStrategyin classDialect
-
getSupportedTemporaryTableKind
public TemporaryTableKind getSupportedTemporaryTableKind()
- Overrides:
getSupportedTemporaryTableKindin classDialect
-
getTemporaryTableCreateOptions
public String getTemporaryTableCreateOptions()
- Overrides:
getTemporaryTableCreateOptionsin classDialect
-
useFollowOnLocking
public boolean useFollowOnLocking(String sql, QueryOptions queryOptions)
For Oracle, the FOR UPDATE clause cannot be applied when using ORDER BY, DISTINCT or views.- Overrides:
useFollowOnLockingin classDialect- 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.- See Also:
- Oracle FOR UPDATE restrictions
-
getQueryHintString
public String getQueryHintString(String sql, String hints)
Description copied from class:DialectApply a hint to the query. The entire query is provided, allowing full control over the placement and syntax of the hint.By default, ignore the hint and simply return the query.
- Overrides:
getQueryHintStringin classDialect- Parameters:
sql- The query to which to apply the hint.hints- The hints to apply- Returns:
- The modified SQL
-
getMaxAliasLength
public int getMaxAliasLength()
Description copied from class:DialectWhat is the maximum length Hibernate can use for generated aliases?The maximum here should account for the fact that Hibernate often needs to append "uniqueing" information to the end of generated aliases. That "uniqueing" information will be added to the end of a identifier generated to the length specified here; so be sure to leave some room (generally speaking 5 positions will suffice).
- Overrides:
getMaxAliasLengthin classDialect- Returns:
- The maximum length.
-
getMaxIdentifierLength
public int getMaxIdentifierLength()
Description copied from class:DialectWhat is the maximum identifier length supported by the dialect?- Overrides:
getMaxIdentifierLengthin classDialect- Returns:
- The maximum length.
-
getCallableStatementSupport
public CallableStatementSupport getCallableStatementSupport()
- Overrides:
getCallableStatementSupportin classDialect
-
canCreateSchema
public boolean canCreateSchema()
Description copied from class:DialectDoes this dialect support schema creation?- Overrides:
canCreateSchemain classDialect- Returns:
- True if the dialect supports schema creation; false otherwise.
-
getCurrentSchemaCommand
public String getCurrentSchemaCommand()
Description copied from class:DialectGet the SQL command used to retrieve the current schema name. Works in conjunction withDialect.getSchemaNameResolver(), unless the return from there does not need this information. E.g., a custom impl might make use of the Java 1.7 addition of theConnection.getSchema()method- Overrides:
getCurrentSchemaCommandin classDialect- Returns:
- The current schema retrieval SQL
-
supportsPartitionBy
public boolean supportsPartitionBy()
Description copied from class:DialectDoes the underlying database support partition by?- Overrides:
supportsPartitionByin classDialect
-
supportsTupleDistinctCounts
public boolean supportsTupleDistinctCounts()
Description copied from class:DialectDoes this dialect supportcount(distinct a,b)?- Overrides:
supportsTupleDistinctCountsin classDialect- Returns:
- True if the database supports counting distinct tuples; false otherwise.
-
supportsOffsetInSubquery
public boolean supportsOffsetInSubquery()
Description copied from class:DialectDoes this dialect supportoffsetin subqueries? For example:select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1 offset 1)- Overrides:
supportsOffsetInSubqueryin classDialect- Returns:
trueif it does
-
supportsFetchClause
public boolean supportsFetchClause(FetchClauseType type)
Description copied from class:DialectDoes this dialect support the given fetch clause type.- Overrides:
supportsFetchClausein classDialect- 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()
Description copied from class:DialectDoes this dialect support window functions likerow_number() over (..)?- Overrides:
supportsWindowFunctionsin classDialect- Returns:
trueif the underlying database supports window functions,falseotherwise. The default isfalse.
-
supportsRecursiveCTE
public boolean supportsRecursiveCTE()
Description copied from class:DialectDoes this dialect/database support recursive CTEs (Common Table Expressions)?- Overrides:
supportsRecursiveCTEin classDialect- Returns:
trueif recursive CTEs are supported
-
supportsLateral
public boolean supportsLateral()
Description copied from class:DialectDoes this dialect support the SQLlateralkeyword or a proprietary alternative?- Overrides:
supportsLateralin classDialect- Returns:
trueif the underlying database supports lateral,falseotherwise. The default isfalse.
-
supportsNoWait
public boolean supportsNoWait()
Description copied from class:DialectDoes this dialect supportNO_WAITtimeout.- Overrides:
supportsNoWaitin classDialect- Returns:
trueifNO_WAITis supported
-
supportsSkipLocked
public boolean supportsSkipLocked()
Description copied from class:DialectDoes this dialect supportSKIP_LOCKEDtimeout.- Overrides:
supportsSkipLockedin classDialect- Returns:
trueif SKIP_LOCKED is supported
-
getWriteRowLockStrategy
public RowLockStrategy getWriteRowLockStrategy()
Description copied from class:DialectThe row lock strategy to use for write locks.- Overrides:
getWriteRowLockStrategyin classDialect
-
getForUpdateNowaitString
public String getForUpdateNowaitString()
Description copied from class:DialectRetrieves theFOR UPDATE NOWAITsyntax specific to this dialect.- Overrides:
getForUpdateNowaitStringin classDialect- Returns:
- The appropriate
FOR UPDATE NOWAITclause string.
-
getForUpdateString
public String getForUpdateString(String aliases)
Description copied from class:DialectGet theFOR UPDATE OF column_listfragment appropriate for this dialect given the aliases of the columns to be write locked.- Overrides:
getForUpdateStringin classDialect- Parameters:
aliases- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE OF column_listclause string.
-
getForUpdateNowaitString
public String getForUpdateNowaitString(String aliases)
Description copied from class:DialectGet theFOR UPDATE OF column_list NOWAITfragment appropriate for this dialect given the aliases of the columns to be write locked.- Overrides:
getForUpdateNowaitStringin classDialect- Parameters:
aliases- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE OF colunm_list NOWAITclause string.
-
getForUpdateSkipLockedString
public String getForUpdateSkipLockedString()
Description copied from class:DialectRetrieves theFOR UPDATE SKIP LOCKEDsyntax specific to this dialect.- Overrides:
getForUpdateSkipLockedStringin classDialect- Returns:
- The appropriate
FOR UPDATE SKIP LOCKEDclause string.
-
getForUpdateSkipLockedString
public String getForUpdateSkipLockedString(String aliases)
Description copied from class:DialectGet theFOR UPDATE OF column_list SKIP LOCKEDfragment appropriate for this dialect given the aliases of the columns to be write locked.- Overrides:
getForUpdateSkipLockedStringin classDialect- Parameters:
aliases- The columns to be write locked.- Returns:
- The appropriate
FOR UPDATE colunm_list SKIP LOCKEDclause string.
-
getWriteLockString
public String getWriteLockString(int timeout)
Description copied from class:DialectGet the string to append to SELECT statements to acquire WRITE locks for this dialect. Location of the returned string is treated the same as getForUpdateString.- Overrides:
getWriteLockStringin classDialect- 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)
Description copied from class:DialectGet the string to append to SELECT statements to acquire WRITE locks for this dialect given the aliases of the columns to be write locked. Location of the of the returned string is treated the same as getForUpdateString.- Overrides:
getWriteLockStringin classDialect- 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)
Description copied from class:DialectGet the string to append to SELECT statements to acquire READ locks for this dialect. Location of the returned string is treated the same as getForUpdateString.- Overrides:
getReadLockStringin classDialect- 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)
Description copied from class:DialectGet the string to append to SELECT statements to acquire READ locks for this dialect given the aliases of the columns to be read locked. Location of the returned string is treated the same as getForUpdateString.- Overrides:
getReadLockStringin classDialect- 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.
-
appendDatetimeFormat
public void appendDatetimeFormat(SqlAppender appender, String format)
Description copied from class:DialectTranslate 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
Appends a pattern accepted by the function that formats dates and times in this dialect to a SQL fragment that is being constructed.
- Overrides:
appendDatetimeFormatin classDialect
-
datetimeFormat
public static Replacer datetimeFormat(String format, boolean useFm, boolean resetFm)
-
appendBinaryLiteral
public void appendBinaryLiteral(SqlAppender appender, byte[] bytes)
- Overrides:
appendBinaryLiteralin classDialect
-
getResultSet
public ResultSet getResultSet(CallableStatement statement, int position) throws SQLException
Description copied from class:DialectGiven a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSet.- Overrides:
getResultSetin classDialect- 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.
-
registerResultSetOutParameter
public int registerResultSetOutParameter(CallableStatement statement, String name) throws SQLException
Description copied from class:DialectRegisters a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of returningResultSet*by name*. Pre-Java 8, registering such ResultSet-returning parameters varied greatly across database and drivers; hence its inclusion as part of the Dialect contract.- Overrides:
registerResultSetOutParameterin classDialect- 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.
-
supportsNamedParameters
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData)
Description copied from class:DialectOverride the DatabaseMetaData#supportsNamedParameters()- Overrides:
supportsNamedParametersin classDialect- Returns:
- boolean
-
getResultSet
public ResultSet getResultSet(CallableStatement statement, String name) throws SQLException
Description copied from class:DialectGiven a callable statement previously processed byDialect.registerResultSetOutParameter(java.sql.CallableStatement, int), extract theResultSetfrom the OUT parameter.- Overrides:
getResultSetin classDialect- 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.
-
generatedAs
public String generatedAs(String generatedAs)
Description copied from class:DialectThegenerated asclause, or similar, for generated column declarations in DDL statements.- Overrides:
generatedAsin classDialect- Parameters:
generatedAs- a SQL expression used to generate the column value- Returns:
- The
generated asclause containing the given expression
-
buildIdentifierHelper
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException
Description copied from class:DialectBuild the IdentifierHelper indicated by this Dialect for handling identifier conversions. Returningnullis allowed and indicates that Hibernate should fallback to building a "standard" helper. In the fallback path, any changes made to the IdentifierHelperBuilder during this call will still be incorporated into the built IdentifierHelper.The incoming builder will have the following set:
IdentifierHelperBuilder.isGloballyQuoteIdentifiers()IdentifierHelperBuilder.getUnquotedCaseStrategy()- initialized to UPPERIdentifierHelperBuilder.getQuotedCaseStrategy()- initialized to MIXED
By default Hibernate will do the following:
- Call
IdentifierHelperBuilder.applyIdentifierCasing(DatabaseMetaData) - Call
IdentifierHelperBuilder.applyReservedWords(DatabaseMetaData) - Applies
AnsiSqlKeywords.sql2003()as reserved words - Applies the {#link #sqlKeywords} collected here as reserved words
- Applies the Dialect's NameQualifierSupport, if it defines one
- Overrides:
buildIdentifierHelperin classDialect- Parameters:
builder- A semi-configured IdentifierHelper builder.dbMetaData- Access to the metadata returned from the driver if needed and if available. WARNING: may benull- Returns:
- The IdentifierHelper instance to use, or
nullto indicate Hibernate should use its fallback path - Throws:
SQLException- Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.- See Also:
Dialect.getNameQualifierSupport()
-
canDisableConstraints
public boolean canDisableConstraints()
Description copied from class:DialectIs 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.)- Overrides:
canDisableConstraintsin classDialect- Returns:
trueif there is some way to do it- See Also:
Dialect.getDisableConstraintsStatement(),Dialect.getDisableConstraintStatement(String, String)
-
getDisableConstraintStatement
public String getDisableConstraintStatement(String tableName, String name)
Description copied from class:DialectA SQL statement that temporarily disables checking of the given foreign key constraint.- Overrides:
getDisableConstraintStatementin classDialect- Parameters:
tableName- the name of the tablename- the name of the constraint
-
getEnableConstraintStatement
public String getEnableConstraintStatement(String tableName, String name)
Description copied from class:DialectA SQL statement that re-enables checking of the given foreign key constraint.- Overrides:
getEnableConstraintStatementin classDialect- Parameters:
tableName- the name of the tablename- the name of the constraint
-
getUniqueDelegate
public UniqueDelegate getUniqueDelegate()
Description copied from class:DialectGet theUniqueDelegatesupported by this dialect- Overrides:
getUniqueDelegatein classDialect- Returns:
- The UniqueDelegate
-
getCreateUserDefinedTypeKindString
public String getCreateUserDefinedTypeKindString()
Description copied from class:DialectCommand used to create a table.- Overrides:
getCreateUserDefinedTypeKindStringin classDialect- Returns:
- The command used to create a table.
-
-