Class SpannerDialect
- All Implemented Interfaces:
FunctionContributor,TypeContributor,ConversionContext
-
Nested Class Summary
Nested classes/interfaces inherited from class org.hibernate.dialect.Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl -
Field Summary
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, FALSE_STRING_VALUES, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY, TRUE_STRING_VALUES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendBooleanValueString(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).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.booleanDoes this dialect support creating and dropping schema?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.charThe character specific to this dialect used to close a quoted identifier.protected StringcolumnType(int sqlTypeCode) static ReplacerdatetimeFormat(String format) booleanDo we need to drop constraints before dropping tables in this dialect?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.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.getAddPrimaryKeyConstraintString(String constraintName) The syntax used to add a primary key constraint to a table.getArrayTypeName(String javaElementTypeName, String elementTypeName, Integer maxLength) The SQL type name for the array type with elements of the given type name.String[]getCreateSchemaCommand(String schemaName) Get the SQL command used to create the named schema.Get the SQL command used to retrieve the current schema name.The command used to retrieve the current timestamp from the database.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.Retrieves theFOR UPDATE NOWAITsyntax specific to this dialect.getForUpdateNowaitString(String aliases) Get theFOR UPDATE OF column_list NOWAITfragment appropriate for this dialect, given the aliases of the columns to be write locked.Retrieves theFOR UPDATE SKIP LOCKEDsyntax specific to this dialect.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.Get the string to append toSELECTstatements to acquire pessimistic UPGRADE locks for this dialect.getForUpdateString(String aliases) Get theFOR UPDATE OF column_listfragment appropriate for this dialect, given the aliases of the columns to be write locked.getForUpdateString(String aliases, LockOptions lockOptions) Get theFOR UPDATE OForFOR SHARE OFfragment appropriate for this dialect, given the aliases of the columns to be locked.getForUpdateString(LockOptions lockOptions) Given a set ofLockOptions(lock level, timeout), determine the appropriatefor updatefragment to use to obtain the lock.Obtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).getLockingClauseStrategy(QuerySpec querySpec, LockOptions lockOptions) Strategy for handling locking clause as part of SqlAstTranslator.getLockingStrategy(EntityPersister lockable, LockMode lockMode) ALockingStrategywhich is able to acquire a database-level lock with the specified level.Access to various details and operations related to this Dialect's support for pessimistic locking.intThe biggest size value that can be supplied as argument to aTypes.VARBINARY-like type.intThe biggest size value that can be supplied as argument to aTypes.VARCHAR-like type.getReadLockString(int timeout) Get the string to append toSELECTstatements to acquire READ locks for this dialect.getReadLockString(Timeout timeout) Get the string to append toSELECTstatements to acquire READ locks for this dialect.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.getReadLockString(String aliases, Timeout timeout) Get the string to append toSELECTstatements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.Get the strategy for determining the schema name from a JDBCConnection, usuallyDefaultSchemaNameResolver.Get theUniqueDelegatesupported by this dialectgetWriteLockString(int timeout) Get the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.getWriteLockString(Timeout timeout) Get the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.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.getWriteLockString(String aliases, Timeout timeout) Get the string to append toSELECTstatements to acquire WRITE locks for this dialect, given the aliases of the columns to be WRITE locked.voidinitializeFunctionRegistry(FunctionContributions functionContributions) Initialize the given registry with any dialect-specific functions.booleanIs the command returned byDialect.getCurrentTimestampSelectString()treated as callable?charThe character specific to this dialect used to begin a quoted identifier.booleanDo we need to qualify index names with the schema name?booleanDoes this dialect supporton deleteactions in foreign key definitions?booleanDoes this dialect support definition of cascade delete constraints which can cause circular chains?booleanDoes this dialect support some way to retrieve the current timestamp value from the database?booleanDoes this dialect supportoffsetin subqueries?booleanIs this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax.booleanIf the dialect supportsrow values, does it offer such support in IN lists as well?booleanIs this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with quantified predicates.booleanDoes this database have native support for ANSI SQL standard arrays which are expressed in terms of the element type name:integer array.timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType) Obtain a pattern for the SQL equivalent to atimestampadd()function call.timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType) Obtain a pattern for the SQL equivalent to atimestampdiff()function call.Return the name used to identify the given field as an argument to theextract()function, or of this dialect's equivalent function.Methods inherited from class org.hibernate.dialect.Dialect
addPartitionKeyToPrimaryKey, addSqlHintOrComment, addUseIndexQueryHint, appendArrayLiteral, appendBinaryLiteral, appendCheckConstraintOptions, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendIntervalLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildIdentifierHelper, buildLockingClauseStrategy, buildOptimisticForceIncrementStrategy, buildOptimisticStrategy, buildPessimisticForceIncrementStrategy, buildPessimisticReadStrategy, buildPessimisticWriteStrategy, buildReadStrategy, buildSQLExceptionConversionDelegate, buildStringToBooleanCast, buildStringToBooleanCastDecode, buildStringToBooleanDecode, canBatchTruncate, canCreateCatalog, canDisableConstraints, castPattern, checkVersion, contribute, contributeFunctions, contributeTypes, createOptionalTableUpdateOperation, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestamp, currentTimestampWithTimeZone, defaultScrollMode, determineDatabaseVersion, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, doesRoundTemporalOnOverflow, equivalentTypes, escapeComment, extractPattern, forceLobAsLastValue, generatedAs, getAddColumnString, getAddColumnSuffixString, getAggregateSupport, getAlterColumnTypeString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getBeforeDropStatement, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getCatalogSeparator, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckConstraintString, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateEnumTypeCommand, getCreateEnumTypeCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getCreateUserDefinedTypeKindString, getCrossReferenceParentTableFilter, getDefaultDecimalPrecision, getDefaultIntervalSecondScale, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultOrdinalityColumnName, getDefaultProperties, getDefaultStatementBatchSize, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintsStatement, getDisableConstraintStatement, getDmlTargetColumnQualifierSupport, getDoublePrecision, getDropCatalogCommand, getDropEnumTypeCommand, getDropEnumTypeCommand, getDropTableString, getDropUniqueKeyString, getDual, getEnableConstraintsStatement, getEnableConstraintStatement, getEnumTypeDeclaration, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getFloatPrecision, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFractionalSecondPrecisionInNanos, getFromDualForSelectOnly, getFunctionalDependencyAnalysisSupport, getGlobalTemporaryTableStrategy, getGroupBySelectItemReferenceStrategy, getHqlTranslator, getIdentityColumnSupport, getIndexExporter, getInExpressionCountLimit, getKeywords, getLobMergeStrategy, getLocalTemporaryTableStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getMaxIdentifierLength, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMaxVarcharCapacity, getMinimumSupportedVersion, getMultiKeyLoadSizingStrategy, getNameQualifierSupport, getNationalizationSupport, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNativeValueGenerationStrategy, getNoColumnsInsertString, getNullColumnString, getNullColumnString, getNullOrdering, getParameterCountLimit, getPersistentTemporaryTableStrategy, getPessimisticLockStyle, getPreferredSqlTypeCodeForArray, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getQueryHintString, getQuerySequencesString, getReadRowLockStrategy, getResultSet, getResultSet, getResultSet, getRowIdColumnString, getSelectClauseNullString, getSelectClauseNullString, getSelectGUIDString, getSequenceInformationExtractor, getSequenceSupport, getSizeStrategy, getSqmTranslatorFactory, getSupportedTemporaryTableKind, getTableCleaner, getTableComment, getTableMigrator, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTimeZoneSupport, getTruncateTableStatement, getTruncateTableStatements, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, getViolatedConstraintNameExtractor, getWriteRowLockStrategy, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, isEmptyStringTreatedAsNull, isJdbcLogWarningsEnabledByDefault, isLob, ordinal, prependComment, quote, quoteCollation, registerColumnTypes, registerDefaultKeywords, registerKeyword, registerKeywords, registerResultSetOutParameter, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, requiresColumnListInCreateView, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeDescriptor, resolveSqlTypeLength, rowId, rowIdSqlType, stripsTrailingSpacesFromChar, supportsAlterColumnType, supportsArrayConstructor, supportsBatchUpdates, supportsBindAsCallableArgument, supportsBindingNullForSetObject, supportsBindingNullSqlTypeForSetNull, supportsBitType, supportsCaseInsensitiveLike, supportsColumnCheck, supportsCommentOn, supportsConflictClauseForInsertCTE, supportsCrossJoin, supportsDistinctFromPredicate, supportsDuplicateSelectItemsInQueryGroup, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsFetchClause, supportsFilterClause, supportsForUpdate, supportsFractionalTimestampArithmetic, supportsFromClauseInUpdate, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsIfExistsBeforeTypeName, supportsInsertReturning, supportsInsertReturningGeneratedKeys, supportsInsertReturningRowId, supportsIntersect, supportsIsTrue, supportsJdbcConnectionLobCreation, supportsJoinInMutationStatementSubquery, supportsJoinsInDelete, supportsLateral, supportsLobValueChangePropagation, supportsLockTimeouts, supportsMaterializedLobAccess, supportsNamedColumnCheck, supportsNamedParameters, supportsNationalizedMethods, supportsNestedSubqueryCorrelation, supportsNestedWithClause, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsNoWait, supportsNullPrecedence, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsPartitionBy, supportsPredicateAsExpression, supportsRecursiveCTE, supportsRecursiveCycleClause, supportsRecursiveCycleUsingClause, supportsRecursiveSearchClause, supportsRefCursors, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowConstructor, supportsRowValueConstructorDistinctFromSyntax, supportsRowValueConstructorGtLtSyntax, supportsRowValueConstructorSyntaxInInSubQuery, supportsSimpleQueryGrouping, supportsSkipLocked, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTableOptions, supportsTemporalLiteralOffset, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsTupleDistinctCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsUpdateReturning, supportsUserDefinedTypes, supportsValuesList, supportsValuesListForInsert, supportsWait, supportsWindowFunctions, supportsWithClause, supportsWithClauseInSubquery, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, trimPattern, unquoteGetGeneratedKeys, useArrayForMultiValuedParameters, useConnectionToCreateLob, useCrossReferenceForeignKeys, useFollowOnLocking, useInputStreamToInsertBlob, useMaterializedLobWhenCapacityExceeded
-
Constructor Details
-
SpannerDialect
public SpannerDialect() -
SpannerDialect
-
-
Method Details
-
columnType
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,$splaceholders for length, precision, scale - See Also:
- Implementations of this method are expected to define a
sensible mapping for
-
castType
Description copied from class:DialectThe SQL type to use incast( ... as ... )expressions when casting to the target type represented by the given JDBC type code. -
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 of
text-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 of
image-like type for the column.- Overrides:
getMaxVarbinaryLengthin classDialect
-
supportsStandardArrays
public boolean supportsStandardArrays()Description copied from class:DialectDoes this database have native support for ANSI SQL standard arrays which are expressed in terms of the element type name:integer array.- Overrides:
supportsStandardArraysin classDialect- Returns:
- boolean
-
getArrayTypeName
public String getArrayTypeName(String javaElementTypeName, String elementTypeName, Integer maxLength) Description copied from class:DialectThe SQL type name for the array type with elements of the given type name.The ANSI-standard syntax is
integer array.- Overrides:
getArrayTypeNamein classDialect
-
initializeFunctionRegistry
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]) -
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)
-
ordinal(arg) -
string(arg)
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
-
-
getSqlAstTranslatorFactory
Description copied from class:Dialect- Overrides:
getSqlAstTranslatorFactoryin classDialect- See Also:
-
getTableExporter
Description copied from class:Dialect- Overrides:
getTableExporterin classDialect
-
supportsCurrentTimestampSelection
public boolean supportsCurrentTimestampSelection()Description copied from class:DialectDoes this dialect support some way to retrieve the current timestamp value from the database?- Overrides:
supportsCurrentTimestampSelectionin classDialect- Returns:
- True if the current timestamp can be retrieved; false otherwise.
-
isCurrentTimestampSelectStringCallable
public boolean isCurrentTimestampSelectStringCallable()Description copied from class:DialectIs the command returned byDialect.getCurrentTimestampSelectString()treated as callable?Typically, this indicates the use of the JDBC escape syntax.
- Overrides:
isCurrentTimestampSelectStringCallablein classDialect- Returns:
- if the
Dialect.getCurrentTimestampSelectString()is treated as callable; false otherwise.
-
getCurrentTimestampSelectString
Description copied from class:DialectThe command used to retrieve the current timestamp from the database.- Overrides:
getCurrentTimestampSelectStringin classDialect
-
appendBooleanValueString
Description copied from class:DialectAppend the SQL literal expression representing the given boolean value to the givenSqlAppender.- Overrides:
appendBooleanValueStringin classDialect- Parameters:
appender- TheSqlAppenderto append the literal expression tobool- The boolean value
-
translateExtractField
Description copied from class:DialectReturn 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.- Overrides:
translateExtractFieldin classDialect
-
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
-
appendDatetimeFormat
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
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.
- Overrides:
appendDatetimeFormatin classDialect
-
datetimeFormat
-
canCreateSchema
public boolean canCreateSchema()Description copied from class:DialectDoes this dialect support creating and dropping schema?- Overrides:
canCreateSchemain classDialect- Returns:
- True if the dialect supports schema creation; false otherwise.
-
getCreateSchemaCommand
Description copied from class:DialectGet the SQL command used to create the named schema.- Overrides:
getCreateSchemaCommandin classDialect- Parameters:
schemaName- The name of the schema to be created.- Returns:
- The creation commands
-
getDropSchemaCommand
Description copied from class:DialectGet the SQL command used to drop the named schema.- Overrides:
getDropSchemaCommandin classDialect- Parameters:
schemaName- The name of the schema to be dropped.- Returns:
- The drop commands
-
getCurrentSchemaCommand
Description copied from class:DialectGet the SQL command used to retrieve the current schema name.Works in conjunction with
Dialect.getSchemaNameResolver(), unless the resultingSchemaNameResolverdoes not need this information. For example, a custom implementation might make use of the Java 1.7Connection.getSchema()method.- Overrides:
getCurrentSchemaCommandin classDialect- Returns:
- The current schema retrieval SQL
-
getSchemaNameResolver
Description copied from class:DialectGet the strategy for determining the schema name from a JDBCConnection, usuallyDefaultSchemaNameResolver.- Overrides:
getSchemaNameResolverin classDialect- Returns:
- The schema name resolver strategy
-
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.
-
qualifyIndexName
public boolean qualifyIndexName()Description copied from class:DialectDo we need to qualify index names with the schema name?- Overrides:
qualifyIndexNamein classDialect- Returns:
trueif we do
-
getDropForeignKeyString
Description copied from class:DialectThe subcommand of thealter tablecommand used to drop a foreign key constraint, usuallydrop constraint.- Overrides:
getDropForeignKeyStringin classDialect
-
getAddForeignKeyConstraintString
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey) Description copied from class:DialectThe syntax used to add a foreign key constraint to a table, with the referenced key columns explicitly specified.- Overrides:
getAddForeignKeyConstraintStringin classDialect- 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
Description copied from class:DialectThe syntax used to add a foreign key constraint to a table, given the definition of the foreign key as a string.- Overrides:
getAddForeignKeyConstraintStringin classDialect- Parameters:
constraintName- The foreign key constraint nameforeignKeyDefinition- The whole definition of the foreign key as a fragment
-
getAddPrimaryKeyConstraintString
Description copied from class:DialectThe syntax used to add a primary key constraint to a table.- Overrides:
getAddPrimaryKeyConstraintStringin classDialect- Parameters:
constraintName- The name of the PK constraint.
-
getLockingSupport
Description copied from class:DialectAccess to various details and operations related to this Dialect's support for pessimistic locking.- Overrides:
getLockingSupportin classDialect
-
getLockingClauseStrategy
Description copied from class:DialectStrategy for handling locking clause as part of SqlAstTranslator.- Overrides:
getLockingClauseStrategyin classDialect
-
getLockingStrategy
Description copied from class:DialectALockingStrategywhich is able to acquire a database-level lock with the specified level.- Overrides:
getLockingStrategyin classDialect- Parameters:
lockable- The persister for the entity to be locked.lockMode- The type of lock to be acquired.- Returns:
- The appropriate locking strategy.
-
getForUpdateString
Description copied from class:DialectGiven a set ofLockOptions(lock level, timeout), determine the appropriatefor updatefragment to use to obtain the lock.- Overrides:
getForUpdateStringin classDialect- Parameters:
lockOptions- contains the lock mode to apply.- Returns:
- The appropriate
for updatefragment.
-
getForUpdateString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire pessimistic UPGRADE locks for this dialect.- Overrides:
getForUpdateStringin classDialect- Returns:
- The appropriate
FOR UPDATEclause string.
-
getForUpdateString
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.
-
getForUpdateString
Description copied from class:DialectGet theFOR UPDATE OForFOR SHARE OFfragment appropriate for this dialect, given the aliases of the columns to be locked.- Overrides:
getForUpdateStringin classDialect- Parameters:
aliases- The columns to be locked.lockOptions- the lock options to apply- Returns:
- The appropriate
FOR UPDATE OF column_listclause string.
-
getWriteLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.- Overrides:
getWriteLockStringin classDialect- Parameters:
timeout- How long the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate lock clause.
-
getWriteLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire WRITE locks for this dialect, given the aliases of the columns to be WRITE locked. * * @param timeout How long the database should wait to acquire the lock.Location of the returned string is treated the same as
Dialect.getForUpdateString().- Overrides:
getWriteLockStringin classDialect- Parameters:
aliases- The columns to be read locked.timeout- How long the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getReadLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire READ locks for this dialect.- Overrides:
getReadLockStringin classDialect- Parameters:
timeout- How long the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getReadLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.- Overrides:
getReadLockStringin classDialect- Parameters:
aliases- The columns to be read locked.timeout- How long the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getWriteLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire pessimistic WRITE locks for this dialect.Location of the returned string is treated the same as
Dialect.getForUpdateString().- Overrides:
getWriteLockStringin classDialect- Parameters:
timeout- How long, in milliseconds, the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getWriteLockString
Description copied from class:DialectGet 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
Dialect.getForUpdateString().- Overrides:
getWriteLockStringin classDialect- Parameters:
aliases- The columns to be read locked.timeout- How long, in milliseconds, the database should wait to acquire the lock. See Timeouts for some "magic values".- Returns:
- The appropriate
LOCKclause string.
-
getReadLockString
Description copied from class:DialectGet the string to append toSELECTstatements to acquire READ locks for this dialect.Location of the returned string is treated the same as
Dialect.getForUpdateString().- Overrides:
getReadLockStringin classDialect- Parameters:
timeout- in milliseconds, -1 for indefinite wait and 0 for no wait.- Returns:
- The appropriate
LOCKclause string.
-
getReadLockString
Description copied from class:DialectGet 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
Dialect.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.
-
getForUpdateNowaitString
Description copied from class:DialectRetrieves theFOR UPDATE NOWAITsyntax specific to this dialect.- Overrides:
getForUpdateNowaitStringin classDialect- Returns:
- The appropriate
FOR UPDATE NOWAITclause string.
-
getForUpdateNowaitString
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
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
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.
-
getSequenceExporter
Description copied from class:Dialect- Overrides:
getSequenceExporterin classDialect
-
getForeignKeyExporter
Description copied from class:Dialect- Overrides:
getForeignKeyExporterin classDialect
-
getUniqueKeyExporter
Description copied from class:Dialect- Overrides:
getUniqueKeyExporterin classDialect
-
applyLocksToSql
public String applyLocksToSql(String sql, LockOptions aliasedLockOptions, Map<String, String[]> keyColumnNames) Description copied from class:DialectModifies 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.- Overrides:
applyLocksToSqlin classDialect- 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.
-
getUniqueDelegate
Description copied from class:DialectGet theUniqueDelegatesupported by this dialect- Overrides:
getUniqueDelegatein classDialect- Returns:
- The UniqueDelegate
-
supportsCircularCascadeDeleteConstraints
public boolean supportsCircularCascadeDeleteConstraints()Description copied from class:DialectDoes this dialect support definition of cascade delete constraints which can cause circular chains?- Overrides:
supportsCircularCascadeDeleteConstraintsin classDialect- Returns:
- True if circular cascade delete constraints are supported; false otherwise.
-
supportsCascadeDelete
public boolean supportsCascadeDelete()Description copied from class:DialectDoes this dialect supporton deleteactions in foreign key definitions?- Overrides:
supportsCascadeDeletein classDialect- Returns:
trueif the dialect does support theon deleteclause.
-
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
-
openQuote
public char openQuote()Description copied from class:DialectThe character specific to this dialect used to begin a quoted identifier. -
closeQuote
public char closeQuote()Description copied from class:DialectThe character specific to this dialect used to close a quoted identifier.- Overrides:
closeQuotein classDialect- Returns:
- The dialect-specific close quote character.
-
getLimitHandler
Description copied from class:DialectObtain aLimitHandlerthat implements pagination support forQuery.setMaxResults(int)andQuery.setFirstResult(int).- Overrides:
getLimitHandlerin classDialect
-
supportsRowValueConstructorSyntax
public boolean supportsRowValueConstructorSyntax()Description copied from class:DialectIs this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax.Basically, does it support syntax like
... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...- Overrides:
supportsRowValueConstructorSyntaxin classDialect- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax; false otherwise.
-
supportsRowValueConstructorSyntaxInQuantifiedPredicates
public boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates()Description copied from class:DialectIs this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax with quantified predicates.Basically, does it support syntax like
... where (FIRST_NAME, LAST_NAME) = ALL (select ...) ...- Overrides:
supportsRowValueConstructorSyntaxInQuantifiedPredicatesin classDialect- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax with quantified predicates; false otherwise.
-
supportsRowValueConstructorSyntaxInInList
public boolean supportsRowValueConstructorSyntaxInInList()Description copied from class:DialectIf the dialect supportsrow values, does it offer such support in IN lists as well?For example,
... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ...- Overrides:
supportsRowValueConstructorSyntaxInInListin classDialect- Returns:
- True if this SQL dialect is known to support "row value constructor" syntax in the IN list; false otherwise.
-