public class PostgreSQLDialect extends Dialect
Dialect.SizeStrategy, Dialect.SizeStrategyImpl
CLOSED_QUOTE, DEFAULT_BATCH_SIZE, LEGACY_LOB_MERGE_STRATEGY, NEW_LOCATOR_LOB_MERGE_STRATEGY, NO_BATCH, QUOTE, STANDARD_DEFAULT_BATCH_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY, TWO_SINGLE_QUOTES_REPLACEMENT
Constructor and Description |
---|
PostgreSQLDialect() |
PostgreSQLDialect(DialectResolutionInfo info) |
PostgreSQLDialect(int version) |
Modifier and Type | Method and Description |
---|---|
void |
augmentRecognizedTableTypes(List<String> tableTypesList) |
IdentifierHelper |
buildIdentifierHelper(IdentifierHelperBuilder builder,
DatabaseMetaData dbMetaData)
Build the IdentifierHelper indicated by this Dialect for handling identifier conversions.
|
SQLExceptionConversionDelegate |
buildSQLExceptionConversionDelegate()
Build an instance of a
SQLExceptionConversionDelegate for
interpreting dialect-specific error or SQLState codes. |
void |
contributeTypes(TypeContributions typeContributions,
ServiceRegistry serviceRegistry)
Allows the Dialect to contribute additional types
|
String |
currentTime()
Translation of the HQL/JPQL
current_time function, which
maps to the Java type java.sql.Time which is a time with
no time zone. |
String |
currentTimestamp()
Translation of the HQL/JPQL
current_timestamp function,
which maps to the Java type java.sql.Timestamp which is
a datetime with no time zone. |
String |
currentTimestampWithTimeZone()
Translation of the HQL
offset_datetime function, which maps
to the Java type java.time.OffsetDateTime which is a datetime
with a time zone. |
Replacer |
datetimeFormat(String format) |
protected void |
extractField(StringBuilder pattern,
TemporalUnit unit,
TemporalType fromTimestamp,
TemporalType toTimestamp,
TemporalUnit toUnit) |
String |
extractPattern(TemporalUnit unit)
The
extract() function returns TemporalUnit.DAY_OF_WEEK
numbered from 0 to 6. |
String |
formatBinaryLiteral(byte[] bytes) |
CallableStatementSupport |
getCallableStatementSupport() |
String |
getCascadeConstraintsString()
The keyword that specifies that a
drop table operation
should be cascaded to its constraints, typically
" cascade" where the leading space is required, or
the empty string if there is no such keyword in this dialect. |
String |
getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive like comparison.
|
String |
getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the
database.
|
SqmMultiTableMutationStrategy |
getFallbackSqmMutationStrategy(EntityMappingType rootEntityDescriptor,
RuntimeModelCreationContext runtimeModelCreationContext) |
String |
getForUpdateNowaitString()
Retrieves the FOR UPDATE NOWAIT syntax specific to this dialect.
|
String |
getForUpdateNowaitString(String aliases)
Get the FOR UPDATE OF column_list NOWAIT fragment appropriate
for this dialect given the aliases of the columns to be write locked.
|
String |
getForUpdateSkipLockedString()
Retrieves the FOR UPDATE SKIP LOCKED syntax specific to this dialect.
|
String |
getForUpdateSkipLockedString(String aliases)
Get the FOR UPDATE OF column_list SKIP LOCKED fragment appropriate
for this dialect given the aliases of the columns to be write locked.
|
String |
getForUpdateString(String aliases)
Get the FOR UPDATE OF column_list fragment appropriate for this
dialect given the aliases of the columns to be write locked.
|
String |
getForUpdateString(String aliases,
LockOptions lockOptions)
Get the FOR UPDATE OF column_list fragment appropriate for this
dialect given the aliases of the columns to be write locked.
|
long |
getFractionalSecondPrecisionInNanos()
microsecond is the smallest unit for an interval ,
and the highest precision for a timestamp , so we could
use it as the "native" precision, but it's more convenient to use
whole seconds (with the fractional part), since we want to use
extract(epoch from ...) in our emulation of
timestampdiff() . |
GroupByConstantRenderingStrategy |
getGroupByConstantRenderingStrategy()
The strategy to use for rendering constants in the GROUP BY clause.
|
GroupBySummarizationRenderingStrategy |
getGroupBySummarizationRenderingStrategy()
The strategy to use for rendering summarizations in the GROUP BY clause.
|
IdentityColumnSupport |
getIdentityColumnSupport()
Get the appropriate
IdentityColumnSupport |
LimitHandler |
getLimitHandler()
Returns a
LimitHandler that implements support for
Query.setMaxResults(int) and
Query.setFirstResult(int) for
this dialect. |
NationalizationSupport |
getNationalizationSupport() |
String |
getNativeIdentifierGeneratorStrategy()
Resolves the native generation strategy associated to this dialect.
|
String |
getNoColumnsInsertString()
The fragment used to insert a row without specifying any column values.
|
String |
getQuerySequencesString()
Get the select command used retrieve the names of all sequences.
|
String |
getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire READ locks
for this dialect.
|
String |
getReadLockString(String aliases,
int timeout)
Get the string to append to SELECT statements to acquire READ locks
for this dialect given the aliases of the columns to be read locked.
|
ResultSet |
getResultSet(CallableStatement ps)
Given a callable statement previously processed by
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
ResultSet |
getResultSet(CallableStatement statement,
int position)
Given a callable statement previously processed by
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet . |
ResultSet |
getResultSet(CallableStatement statement,
String name)
Given a callable statement previously processed by
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
String |
getSelectClauseNullString(int sqlType)
Workaround for postgres bug #1453
Given a
Types type code, determine an appropriate
null value to use in a select clause. |
SequenceSupport |
getSequenceSupport() |
SqlAstTranslatorFactory |
getSqlAstTranslatorFactory()
Return an SqlAstTranslatorFactory specific for the Dialect.
|
JdbcTypeDescriptor |
getSqlTypeDescriptorOverride(int sqlCode)
Returns the
JdbcTypeDescriptor that should be used to handle the given JDBC type code. |
int |
getVersion() |
ViolatedConstraintNameExtractor |
getViolatedConstraintNameExtractor() |
String |
getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect.
|
String |
getWriteLockString(String aliases,
int timeout)
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect given the aliases of the columns to be write locked.
|
RowLockStrategy |
getWriteRowLockStrategy()
The row lock strategy to use for write locks.
|
void |
initializeFunctionRegistry(QueryEngine queryEngine)
Initialize the given registry with any dialect-specific functions.
|
boolean |
isCurrentTimestampSelectStringCallable()
Should the value returned by
Dialect.getCurrentTimestampSelectString()
be treated as callable. |
boolean |
qualifyIndexName()
Do we need to qualify index names with the schema name?
|
int |
registerResultSetOutParameter(CallableStatement statement,
int col)
Registers a parameter (either OUT, or the new REF_CURSOR param type available in Java 8) capable of
returning
ResultSet *by position*. |
boolean |
requiresParensForTupleDistinctCounts()
If
Dialect.supportsTupleDistinctCounts() is true, does the Dialect require the tuple to be wrapped with parens? |
boolean |
supportsCaseInsensitiveLike()
Does this dialect support case insensitive LIKE restrictions?
|
boolean |
supportsCommentOn()
Does this dialect/database support commenting on tables, columns, etc?
|
boolean |
supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current
timestamp value?
|
boolean |
supportsEmptyInList()
Does this dialect support empty IN lists?
For example, is [where XYZ in ()] a supported construct?
|
boolean |
supportsFetchClause(FetchClauseType type)
Does this dialect support the given fetch clause type.
|
boolean |
supportsIfExistsAfterAlterTable()
For an "alter table", can the phrase "if exists" be applied?
|
boolean |
supportsIfExistsBeforeConstraintName()
For dropping a constraint with an "alter table", can the phrase "if exists" be applied before the constraint name?
NOTE : Only one or the other (or neither) of this and
Dialect.supportsIfExistsAfterConstraintName() should return true |
boolean |
supportsIfExistsBeforeTableName()
For dropping a table, can the phrase "if exists" be applied before the table name?
NOTE : Only one or the other (or neither) of this and
Dialect.supportsIfExistsAfterTableName() should return true |
boolean |
supportsJdbcConnectionLobCreation(DatabaseMetaData databaseMetaData)
Check whether the JDBC
Connection supports creating LOBs via Connection.createBlob() ,
Connection.createNClob() or Connection.createClob() . |
boolean |
supportsLobValueChangePropagation()
Does the dialect support propagating changes to LOB
values back to the database? Talking about mutating the
internal value of the locator as opposed to supplying a new
locator instance...
|
boolean |
supportsNonQueryWithCTE()
Does this dialect/database support non-query statements (e.g.
|
boolean |
supportsNoWait()
Does this dialect/database support NO_WAIT timeout.
|
boolean |
supportsOffsetInSubquery()
Does this dialect support offset in subqueries? Ex:
select * from Table1 where col1 in (select col1 from Table2 order by col2 limit 1 offset 1)
|
boolean |
supportsOuterJoinForUpdate()
Does this dialect support FOR UPDATE in conjunction with
outer joined rows?
|
boolean |
supportsPartitionBy()
Does the underlying database support partition by
|
boolean |
supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value
constructor" syntax; sometimes called tuple syntax.
|
boolean |
supportsRowValueConstructorSyntaxInInList()
If the dialect supports
row values ,
does it offer such support in IN lists as well?
For example, "... |
boolean |
supportsRowValueConstructorSyntaxInQuantifiedPredicates()
Is this dialect known to support what ANSI-SQL terms "row value
constructor" syntax; sometimes called tuple syntax with quantified predicates.
|
boolean |
supportsSelectAliasInGroupByClause() |
boolean |
supportsSkipLocked()
Does this dialect/database support SKIP_LOCKED timeout.
|
boolean |
supportsTimezoneTypes()
Whether the Dialect supports timezone types like
Types.TIMESTAMP_WITH_TIMEZONE . |
boolean |
supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in
which it was created?
Again, part of the trickiness here is the fact that this is largely
driver dependent.
|
boolean |
supportsValuesList()
Does this dialect/database support VALUES list (e.g.
|
boolean |
supportsWait()
Does this dialect/database support WAIT timeout.
|
boolean |
supportsWindowFunctions()
Does this dialect support window functions like `row_number() over (..)`
|
String |
timestampaddPattern(TemporalUnit unit,
TemporalType temporalType)
Obtain a pattern for the SQL equivalent to a
timestampadd() function call. |
String |
timestampdiffPattern(TemporalUnit unit,
TemporalType fromTemporalType,
TemporalType toTemporalType)
Obtain a pattern for the SQL equivalent to a
timestampdiff() function call. |
String |
toBooleanValueString(boolean bool)
The SQL literal value to which this database maps boolean values.
|
String |
translateDatetimeFormat(String format)
Translate the given datetime format string from
the pattern language defined by Java's
DateTimeFormatter to
whatever pattern language is understood by the
native datetime formatting function for this
database (often the to_char() function). |
String |
translateExtractField(TemporalUnit unit)
Return the name used to identify the given field
as an argument to the
extract() function,
or of this dialect's equivalent
function. |
boolean |
useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
|
protected String |
wrapDateLiteral(String date) |
protected String |
wrapTimeLiteral(String time) |
protected String |
wrapTimestampLiteral(String timestamp) |
addSqlHintOrComment, appendLockHint, appendLockHint, applyLocksToSql, areStringComparisonsCaseInsensitive, binaryToDecimalPrecision, bindLimitParametersFirst, bindLimitParametersInReverseOrder, buildSQLExceptionConverter, canCreateCatalog, canCreateSchema, castPattern, closeQuote, convertToFirstRowValue, createCaseFragment, createOuterJoinFragment, currentDate, currentLocalTime, currentLocalTimestamp, defaultScrollMode, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, dropConstraints, equivalentTypes, escapeComment, escapeLiteral, forceLimitUsage, forceLobAsLastValue, formatAsTimestamp, formatAsTimestamp, formatAsTimestamp, formatDateTimeLiteral, formatDateTimeLiteral, formatDateTimeLiteral, forUpdateOfColumns, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAddUniqueConstraintString, getAlterTableString, getAuxiliaryDatabaseObjectExporter, getBooleanCheckCondition, getCastTypeName, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateMultisetTableString, getCreateSchemaCommand, getCreateSequenceString, getCreateSequenceString, getCreateSequenceStrings, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCrossJoinSeparator, getCurrentSchemaCommand, getCurrentTimestampSQLFunctionName, getDefaultBatchLoadSizingStrategy, getDefaultDecimalPrecision, getDefaultLobLength, getDefaultProperties, getDefaultTimestampPrecision, getDialect, getDialect, getDoublePrecision, getDropCatalogCommand, getDropForeignKeyString, getDropSchemaCommand, getDropSequenceString, getDropSequenceStrings, getDropTableString, getEnumCheckCondition, getFloatPrecision, getForeignKeyExporter, getForUpdateString, getForUpdateString, getForUpdateString, getFromDual, getHibernateTypeName, getHibernateTypeName, getHqlTranslator, getIndexExporter, getInExpressionCountLimit, getKeywords, getLimitString, getLimitString, getLobMergeStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getNameQualifierSupport, getNativeIdentifierGeneratorClass, getNotExpression, getNullColumnString, getNullColumnString, getNullOrdering, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getQueryHintString, getRawTypeName, getRawTypeName, getReadRowLockStrategy, getSchemaNameResolver, getSelectGUIDString, getSelectSequenceNextValString, getSequenceExporter, getSequenceInformationExtractor, getSequenceNextValString, getSequenceNextValString, getSizeStrategy, getSqmTranslatorFactory, getTableAliasSeparator, getTableComment, getTableExporter, getTableTypeString, getTypeName, getTypeName, getTypeName, getTypeName, getUniqueDelegate, getUniqueKeyExporter, hasAlterTable, hasSelfReferentialForeignKeyBug, inlineLiteral, isEmptyStringTreatedAsNull, isJdbcLogWarningsEnabledByDefault, isLockTimeoutParameterized, isTypeNameRegistered, openQuote, prependComment, quote, registerColumnType, registerColumnType, registerHibernateType, registerHibernateType, registerKeyword, registerResultSetOutParameter, remapSqlTypeDescriptor, renderOrderByElement, replaceResultVariableInOrderByClauseWithPosition, requiresCastingOfParametersInSelectClause, requiresFloatCastingOfIntegerDivision, resolveSqlTypeDescriptor, supportsBindAsCallableArgument, supportsBitType, supportsCascadeDelete, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsFractionalTimestampArithmetic, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsLimit, supportsLimitOffset, supportsLockTimeouts, supportsNamedParameters, supportsNationalizedTypes, supportsNoColumnsInsert, supportsNotNullUnique, supportsNullPrecedence, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsParametersInInsertSelect, supportsPooledSequences, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowValueConstructorSyntaxInInSubquery, supportsRowValueConstructorSyntaxInSet, supportsSelectQueryWithoutFromClause, supportsSequences, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTemporalLiteralOffset, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsTupleDistinctCounts, supportsTuplesInSubqueries, supportsUnionAll, supportsUnionInSubquery, supportsUnique, supportsUniqueConstraintInCreateAlterTable, supportsValuesListForInsert, supportsVariableLimit, toString, transformSelectString, translateDurationField, trimPattern, useFollowOnLocking, useMaxForLimit
public PostgreSQLDialect(DialectResolutionInfo info)
public PostgreSQLDialect()
public PostgreSQLDialect(int version)
public int getVersion()
getVersion
in class Dialect
public String currentTime()
Dialect
current_time
function, which
maps to the Java type java.sql.Time
which is a time with
no time zone. This contradicts ANSI SQL where current_time
has the type TIME WITH TIME ZONE
.
It is recommended to override this in dialects for databases which
support localtime
or time at local
.
currentTime
in class Dialect
public String currentTimestamp()
Dialect
current_timestamp
function,
which maps to the Java type java.sql.Timestamp
which is
a datetime with no time zone. This contradicts ANSI SQL where
current_timestamp
has the type
TIMESTAMP WITH TIME ZONE
.
It is recommended to override this in dialects for databases which
support localtimestamp
or timestamp at local
.
currentTimestamp
in class Dialect
public String currentTimestampWithTimeZone()
Dialect
offset_datetime
function, which maps
to the Java type java.time.OffsetDateTime
which is a datetime
with a time zone. This in principle correctly maps to the ANSI SQL
current_timestamp
which has the type
TIMESTAMP WITH TIME ZONE
.currentTimestampWithTimeZone
in class Dialect
public String extractPattern(TemporalUnit unit)
extract()
function returns TemporalUnit.DAY_OF_WEEK
numbered from 0 to 6. This isn't consistent with what most other
databases do, so here we adjust the result by generating
(extract(dow,arg)+1))
.extractPattern
in class Dialect
unit
- the first argumentpublic long getFractionalSecondPrecisionInNanos()
microsecond
is the smallest unit for an interval
,
and the highest precision for a timestamp
, so we could
use it as the "native" precision, but it's more convenient to use
whole seconds (with the fractional part), since we want to use
extract(epoch from ...)
in our emulation of
timestampdiff()
.getFractionalSecondPrecisionInNanos
in class Dialect
TemporalUnit.NATIVE
public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType)
Dialect
timestampadd()
function call. The resulting
pattern must contain ?1, ?2, and ?3 placeholders
for the arguments.timestampaddPattern
in class Dialect
unit
- the first argumenttemporalType
- true if the third argument is apublic String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType)
Dialect
timestampdiff()
function call. The resulting
pattern must contain ?1, ?2, and ?3 placeholders
for the arguments.timestampdiffPattern
in class Dialect
unit
- the first argumentfromTemporalType
- true if the first argument is
a timestamp, false if a datetoTemporalType
- true if the second argument isprotected void extractField(StringBuilder pattern, TemporalUnit unit, TemporalType fromTimestamp, TemporalType toTimestamp, TemporalUnit toUnit)
public boolean supportsTimezoneTypes()
Dialect
Types.TIMESTAMP_WITH_TIMEZONE
.supportsTimezoneTypes
in class Dialect
public void initializeFunctionRegistry(QueryEngine queryEngine)
Dialect
initializeFunctionRegistry
in class Dialect
public JdbcTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode)
Dialect
JdbcTypeDescriptor
that should be used to handle the given JDBC type code. Returns
null
if there is no override.getSqlTypeDescriptorOverride
in class Dialect
sqlCode
- A Types
constant indicating the SQL column typeJdbcTypeDescriptor
to use as an override, or null
if there is no override.public boolean supportsIfExistsBeforeTableName()
Dialect
Dialect.supportsIfExistsAfterTableName()
should return truesupportsIfExistsBeforeTableName
in class Dialect
true
if the "if exists" can be applied before the table namepublic boolean supportsIfExistsBeforeConstraintName()
Dialect
Dialect.supportsIfExistsAfterConstraintName()
should return truesupportsIfExistsBeforeConstraintName
in class Dialect
true
if the "if exists" can be applied before the constraint namepublic boolean supportsIfExistsAfterAlterTable()
Dialect
supportsIfExistsAfterAlterTable
in class Dialect
true
if the "if exists" can be applied after ALTER TABLEpublic boolean supportsValuesList()
Dialect
supportsValuesList
in class Dialect
true
if VALUES list are supportedpublic boolean supportsRowValueConstructorSyntaxInInList()
Dialect
row values
,
does it offer such support in IN lists as well?
For example, "... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ..."supportsRowValueConstructorSyntaxInInList
in class Dialect
public boolean supportsPartitionBy()
Dialect
supportsPartitionBy
in class Dialect
public boolean supportsNonQueryWithCTE()
Dialect
supportsNonQueryWithCTE
in class Dialect
true
if non-query statements are supported with CTEpublic SequenceSupport getSequenceSupport()
getSequenceSupport
in class Dialect
public String getCascadeConstraintsString()
Dialect
drop table
operation
should be cascaded to its constraints, typically
" cascade"
where the leading space is required, or
the empty string if there is no such keyword in this dialect.getCascadeConstraintsString
in class Dialect
public String getQuerySequencesString()
Dialect
getQuerySequencesString
in class Dialect
SchemaUpdate
public LimitHandler getLimitHandler()
Dialect
LimitHandler
that implements support for
Query.setMaxResults(int)
and
Query.setFirstResult(int)
for
this dialect.getLimitHandler
in class Dialect
public String getForUpdateString(String aliases)
Dialect
getForUpdateString
in class Dialect
aliases
- The columns to be write locked.public String getForUpdateString(String aliases, LockOptions lockOptions)
Dialect
getForUpdateString
in class Dialect
aliases
- The columns to be write locked.lockOptions
- the lock options to applypublic String getNoColumnsInsertString()
Dialect
getNoColumnsInsertString
in class Dialect
public String getCaseInsensitiveLike()
Dialect
getCaseInsensitiveLike
in class Dialect
public boolean supportsCaseInsensitiveLike()
Dialect
supportsCaseInsensitiveLike
in class Dialect
true
if the underlying database supports case insensitive like comparison,
false
otherwise. The default is false
.public String getNativeIdentifierGeneratorStrategy()
Dialect
getNativeIdentifierGeneratorStrategy
in class Dialect
public boolean supportsOuterJoinForUpdate()
Dialect
supportsOuterJoinForUpdate
in class Dialect
public boolean useInputStreamToInsertBlob()
Dialect
PreparedStatement.setBinaryStream(int, java.io.InputStream, int)
).useInputStreamToInsertBlob
in class Dialect
public String getSelectClauseNullString(int sqlType)
Types
type code, determine an appropriate
null value to use in a select clause.
One thing to consider here is that certain databases might
require proper casting for the nulls here since the select here
will be part of a UNION/UNION ALL.getSelectClauseNullString
in class Dialect
sqlType
- The Types
type code.public boolean supportsCommentOn()
Dialect
supportsCommentOn
in class Dialect
true
if commenting is supportedpublic boolean supportsCurrentTimestampSelection()
Dialect
supportsCurrentTimestampSelection
in class Dialect
public boolean isCurrentTimestampSelectStringCallable()
Dialect
Dialect.getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape
syntax is being used...isCurrentTimestampSelectStringCallable
in class Dialect
Dialect.getCurrentTimestampSelectString()
return
is callable; false otherwise.public String getCurrentTimestampSelectString()
Dialect
getCurrentTimestampSelectString
in class Dialect
public boolean requiresParensForTupleDistinctCounts()
Dialect
Dialect.supportsTupleDistinctCounts()
is true, does the Dialect require the tuple to be wrapped with parens?requiresParensForTupleDistinctCounts
in class Dialect
public String toBooleanValueString(boolean bool)
Dialect
toBooleanValueString
in class Dialect
bool
- The boolean valuepublic IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData) throws SQLException
Dialect
null
is allowed and indicates that Hibernate should fallback to building a
"standard" helper. In the fallback path, any changes made to the IdentifierHelperBuilder
during this call will still be incorporated into the built IdentifierHelper.
The incoming builder will have the following set:IdentifierHelperBuilder.isGloballyQuoteIdentifiers()
IdentifierHelperBuilder.getUnquotedCaseStrategy()
- initialized to UPPERIdentifierHelperBuilder.getQuotedCaseStrategy()
- initialized to MIXEDIdentifierHelperBuilder.applyIdentifierCasing(DatabaseMetaData)
IdentifierHelperBuilder.applyReservedWords(DatabaseMetaData)
AnsiSqlKeywords.sql2003()
as reserved wordsbuildIdentifierHelper
in class Dialect
builder
- A semi-configured IdentifierHelper builder.dbMetaData
- Access to the metadata returned from the driver if needed and if available. WARNING: may be null
null
to indicate Hibernate should use its fallback pathSQLException
- Accessing the DatabaseMetaData can throw it. Just re-throw and Hibernate will handle.Dialect.getNameQualifierSupport()
public SqmMultiTableMutationStrategy getFallbackSqmMutationStrategy(EntityMappingType rootEntityDescriptor, RuntimeModelCreationContext runtimeModelCreationContext)
getFallbackSqmMutationStrategy
in class Dialect
public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
Dialect
null
to use Hibernate's standard translator.getSqlAstTranslatorFactory
in class Dialect
StandardSqlAstTranslatorFactory
,
JdbcEnvironment.getSqlAstTranslatorFactory()
public ViolatedConstraintNameExtractor getViolatedConstraintNameExtractor()
getViolatedConstraintNameExtractor
in interface ConversionContext
getViolatedConstraintNameExtractor
in class Dialect
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
Dialect
SQLExceptionConversionDelegate
for
interpreting dialect-specific error or SQLState codes.
When Dialect.buildSQLExceptionConverter()
returns null, the default
SQLExceptionConverter
is used to interpret SQLState and
error codes. If this method is overridden to return a non-null value,
the default SQLExceptionConverter
will use the returned
SQLExceptionConversionDelegate
in addition to the following
standard delegates:
buildSQLExceptionConversionDelegate
in class Dialect
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException
Dialect
ResultSet
*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.registerResultSetOutParameter
in class Dialect
statement
- The callable statement.col
- The bind position at which to register the output param.SQLException
- Indicates problems registering the param.public ResultSet getResultSet(CallableStatement ps) throws SQLException
Dialect
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.getResultSet
in class Dialect
ps
- The callable statement.SQLException
- Indicates problems extracting the result set.public boolean supportsEmptyInList()
Dialect
supportsEmptyInList
in class Dialect
public boolean supportsLobValueChangePropagation()
Dialect
Blob.setBinaryStream(long)
,
Blob.setBytes(long, byte[])
,
Blob.setBytes(long, byte[], int, int)
,
or Blob.truncate(long)
.
For CLOBs, the internal value might be changed by:
Clob.setAsciiStream(long)
,
Clob.setCharacterStream(long)
,
Clob.setString(long, String)
,
Clob.setString(long, String, int, int)
,
or Clob.truncate(long)
.
NOTE : I do not know the correct answer currently for
databases which (1) are not part of the cruise control process
or (2) do not Dialect.supportsExpectedLobUsagePattern()
.supportsLobValueChangePropagation
in class Dialect
public boolean supportsUnboundedLobLocatorMaterialization()
Dialect
Dialect.supportsExpectedLobUsagePattern()
also support the ability to materialize a LOB outside the owning transaction...supportsUnboundedLobLocatorMaterialization
in class Dialect
public boolean supportsRowValueConstructorSyntax()
Dialect
supportsRowValueConstructorSyntax
in class Dialect
public boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates()
Dialect
supportsRowValueConstructorSyntaxInQuantifiedPredicates
in class Dialect
public boolean supportsSelectAliasInGroupByClause()
supportsSelectAliasInGroupByClause
in class Dialect
public CallableStatementSupport getCallableStatementSupport()
getCallableStatementSupport
in class Dialect
public ResultSet getResultSet(CallableStatement statement, int position) throws SQLException
Dialect
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
.getResultSet
in class Dialect
statement
- The callable statement.position
- The bind position at which to register the output param.SQLException
- Indicates problems extracting the result set.public ResultSet getResultSet(CallableStatement statement, String name) throws SQLException
Dialect
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.getResultSet
in class Dialect
statement
- The callable statement.name
- The parameter name (for drivers which support named parameters).SQLException
- Indicates problems extracting the result set.public boolean qualifyIndexName()
Dialect
qualifyIndexName
in class Dialect
public IdentityColumnSupport getIdentityColumnSupport()
Dialect
IdentityColumnSupport
getIdentityColumnSupport
in class Dialect
public NationalizationSupport getNationalizationSupport()
getNationalizationSupport
in class Dialect
public boolean supportsJdbcConnectionLobCreation(DatabaseMetaData databaseMetaData)
Dialect
Connection
supports creating LOBs via Connection.createBlob()
,
Connection.createNClob()
or Connection.createClob()
.supportsJdbcConnectionLobCreation
in class Dialect
databaseMetaData
- JDBC DatabaseMetaData
which can be used if LOB creation is supported only starting from a given Driver versiontrue
if LOBs can be created via the JDBC Connection.public String translateDatetimeFormat(String format)
Dialect
DateTimeFormatter
to
whatever pattern language is understood by the
native datetime formatting function for this
database (often the to_char()
function).
Since it's never possible to translate all of
the pattern letter sequences understood by
DateTimeFormatter
, only the following
subset of pattern letters is accepted by
Hibernate:
translateDatetimeFormat
in class Dialect
public String translateExtractField(TemporalUnit unit)
Dialect
extract()
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
, nor
TemporalUnit.WEEK_OF_MONTH
,
which are already desugared by
ExtractFunction
.
translateExtractField
in class Dialect
public String formatBinaryLiteral(byte[] bytes)
formatBinaryLiteral
in class Dialect
protected String wrapDateLiteral(String date)
wrapDateLiteral
in class Dialect
protected String wrapTimeLiteral(String time)
wrapTimeLiteral
in class Dialect
protected String wrapTimestampLiteral(String timestamp)
wrapTimestampLiteral
in class Dialect
public String getWriteLockString(int timeout)
Dialect
getWriteLockString
in class Dialect
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getWriteLockString(String aliases, int timeout)
Dialect
getWriteLockString
in class Dialect
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getReadLockString(int timeout)
Dialect
getReadLockString
in class Dialect
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getReadLockString(String aliases, int timeout)
Dialect
getReadLockString
in class Dialect
aliases
- The columns to be read locked.timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.public String getForUpdateNowaitString()
Dialect
getForUpdateNowaitString
in class Dialect
public String getForUpdateNowaitString(String aliases)
Dialect
getForUpdateNowaitString
in class Dialect
aliases
- The columns to be write locked.public String getForUpdateSkipLockedString()
Dialect
getForUpdateSkipLockedString
in class Dialect
public String getForUpdateSkipLockedString(String aliases)
Dialect
getForUpdateSkipLockedString
in class Dialect
aliases
- The columns to be write locked.public boolean supportsNoWait()
Dialect
supportsNoWait
in class Dialect
true
if NO_WAIT is supportedpublic boolean supportsWait()
Dialect
supportsWait
in class Dialect
true
if WAIT is supportedpublic boolean supportsSkipLocked()
Dialect
supportsSkipLocked
in class Dialect
true
if SKIP_LOCKED is supportedpublic boolean supportsOffsetInSubquery()
Dialect
supportsOffsetInSubquery
in class Dialect
public boolean supportsWindowFunctions()
Dialect
supportsWindowFunctions
in class Dialect
true
if the underlying database supports window functions,
false
otherwise. The default is false
.public boolean supportsFetchClause(FetchClauseType type)
Dialect
supportsFetchClause
in class Dialect
type
- The fetch clause typetrue
if the underlying database supports the given fetch clause type,
false
otherwise. The default is false
.public RowLockStrategy getWriteRowLockStrategy()
Dialect
getWriteRowLockStrategy
in class Dialect
public GroupBySummarizationRenderingStrategy getGroupBySummarizationRenderingStrategy()
Dialect
getGroupBySummarizationRenderingStrategy
in class Dialect
public GroupByConstantRenderingStrategy getGroupByConstantRenderingStrategy()
Dialect
getGroupByConstantRenderingStrategy
in class Dialect
public void augmentRecognizedTableTypes(List<String> tableTypesList)
augmentRecognizedTableTypes
in class Dialect
public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
Dialect
contributeTypes
in class Dialect
typeContributions
- Callback to contribute the typesserviceRegistry
- The service registryCopyright © 2001-2021 Red Hat, Inc. All Rights Reserved.