Package org.hibernate.dialect
Class PostgresPlusDialect
java.lang.Object
org.hibernate.dialect.Dialect
org.hibernate.dialect.PostgreSQLDialect
org.hibernate.dialect.PostgresPlusDialect
- All Implemented Interfaces:
FunctionContributor,TypeContributor,ConversionContext
An SQL dialect for Postgres Plus
-
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.PostgreSQLDialect
driverKind, MINIMUM_VERSIONFields 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
ConstructorsConstructorDescriptionConstructs a PostgresPlusDialectPostgresPlusDialect(DatabaseVersion version) -
Method Summary
Modifier and TypeMethodDescriptioncastPattern(CastType from, CastType to) Obtain a pattern for the SQL equivalent to acast()function call.Translation of the HQL/JPQLcurrent_timestampfunction, which maps to the Java typeTimestampwhich is a datetime with no time zone.Get the command used to select a GUID from the database.voidinitializeFunctionRegistry(FunctionContributions functionContributions) Initialize the given registry with any dialect-specific functions.booleanReturn whether the dialect considers an empty string value to be null.intregisterResultSetOutParameter(CallableStatement statement, int col) Registers a parameter capable of returning aResultSetby position, either anOUTparameter, or aREF_CURSORparameter as defined in Java 8.timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType) Obtain a pattern for the SQL equivalent to atimestampdiff()function call.Methods inherited from class org.hibernate.dialect.PostgreSQLDialect
addPartitionKeyToPrimaryKey, addSqlHintOrComment, appendBinaryLiteral, appendBooleanValueString, appendDatetimeFormat, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, augmentRecognizedTableTypes, buildIdentifierHelper, buildSQLExceptionConversionDelegate, canBatchTruncate, castType, columnType, contributePostgreSQLTypes, contributeTypes, createOptionalTableUpdateOperation, currentTime, currentTimestampWithTimeZone, datetimeFormat, extractPattern, getAggregateSupport, getAlterColumnTypeString, getBeforeDropStatement, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getCreateEnumTypeCommand, getCurrentSchemaCommand, getCurrentTimestampSelectString, getDefaultIntervalSecondScale, getDefaultNonContextualLobCreation, getDefaultOrdinalityColumnName, getDefaultStatementBatchSize, getDmlTargetColumnQualifierSupport, getDriverKind, getDropEnumTypeCommand, getEnumTypeDeclaration, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getForUpdateString, getForUpdateString, getFractionalSecondPrecisionInNanos, getFunctionalDependencyAnalysisSupport, getGroupBySelectItemReferenceStrategy, getIdentityColumnSupport, getLimitHandler, getLocalTemporaryTableStrategy, getLockingSupport, getMaxIdentifierLength, getMaxVarbinaryLength, getMaxVarcharCapacity, getMaxVarcharLength, getMinimumSupportedVersion, getNameQualifierSupport, getNationalizationSupport, getNativeParameterMarkerStrategy, getNativeValueGenerationStrategy, getNoColumnsInsertString, getQueryHintString, getQuerySequencesString, getReadLockString, getReadLockString, getReadLockString, getReadLockString, getResultSet, getResultSet, getResultSet, getSelectClauseNullString, getSelectClauseNullString, getSequenceSupport, getTableExporter, getTimeZoneSupport, getUniqueDelegate, getViolatedConstraintNameExtractor, getWriteLockString, getWriteLockString, getWriteLockString, getWriteLockString, isCurrentTimestampSelectStringCallable, qualifyIndexName, quoteCollation, registerColumnTypes, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeDescriptor, rowId, rowIdSqlType, supportsAlterColumnType, supportsArrayConstructor, supportsBindingNullSqlTypeForSetNull, supportsCaseInsensitiveLike, supportsCommentOn, supportsConflictClauseForInsertCTE, supportsCurrentTimestampSelection, supportsDistinctFromPredicate, supportsFetchClause, supportsFilterClause, supportsFromClauseInUpdate, supportsIfExistsAfterAlterTable, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeTableName, supportsIfExistsBeforeTypeName, supportsInsertReturning, supportsIsTrue, supportsJdbcConnectionLobCreation, supportsLateral, supportsLobValueChangePropagation, supportsMaterializedLobAccess, supportsMinMaxOnUuid, supportsNonQueryWithCTE, supportsOffsetInSubquery, supportsPartitionBy, supportsRecursiveCTE, supportsRecursiveCycleClause, supportsRecursiveCycleUsingClause, supportsRecursiveSearchClause, supportsRowConstructor, supportsStandardArrays, supportsTemporalLiteralOffset, supportsTupleCounts, supportsUnboundedLobLocatorMaterialization, supportsUserDefinedTypes, supportsValuesList, supportsWindowFunctions, timestampaddPattern, translateExtractField, useConnectionToCreateLob, useInputStreamToInsertBlobMethods inherited from class org.hibernate.dialect.Dialect
addUseIndexQueryHint, appendArrayLiteral, appendCheckConstraintOptions, appendIntervalLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, buildLockingClauseStrategy, buildOptimisticForceIncrementStrategy, buildOptimisticStrategy, buildPessimisticForceIncrementStrategy, buildPessimisticReadStrategy, buildPessimisticWriteStrategy, buildReadStrategy, buildStringToBooleanCast, buildStringToBooleanCastDecode, buildStringToBooleanDecode, canCreateCatalog, canCreateSchema, canDisableConstraints, checkVersion, closeQuote, contribute, contributeFunctions, currentDate, currentLocalTime, currentLocalTimestamp, defaultScrollMode, determineDatabaseVersion, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, doesRoundTemporalOnOverflow, dropConstraints, equivalentTypes, escapeComment, forceLobAsLastValue, generatedAs, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getCatalogSeparator, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckConstraintString, getColumnAliasExtractor, getColumnComment, getCreateCatalogCommand, getCreateEnumTypeCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getCreateUserDefinedTypeKindString, getCrossReferenceParentTableFilter, getDefaultDecimalPrecision, getDefaultLobLength, getDefaultProperties, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintsStatement, getDisableConstraintStatement, getDoublePrecision, getDropCatalogCommand, getDropEnumTypeCommand, getDropForeignKeyString, getDropSchemaCommand, getDropTableString, getDropUniqueKeyString, getDual, getEnableConstraintsStatement, getEnableConstraintStatement, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFloatPrecision, getForeignKeyExporter, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFromDualForSelectOnly, getGlobalTemporaryTableStrategy, getHqlTranslator, getIndexExporter, getInExpressionCountLimit, getKeywords, getLobMergeStrategy, getLockingClauseStrategy, getLockingStrategy, getLockingStrategy, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxVarbinaryCapacity, getMultiKeyLoadSizingStrategy, getNativeIdentifierGeneratorStrategy, getNullColumnString, getNullColumnString, getNullOrdering, getParameterCountLimit, getPersistentTemporaryTableStrategy, getPessimisticLockStyle, getPreferredSqlTypeCodeForArray, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getReadRowLockStrategy, getRowIdColumnString, getSchemaNameResolver, getSequenceExporter, getSequenceInformationExtractor, getSizeStrategy, getSqmTranslatorFactory, getSupportedTemporaryTableKind, getTableCleaner, getTableComment, getTableMigrator, getTableTypeString, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTruncateTableStatement, getTruncateTableStatements, getUniqueKeyExporter, getUserDefinedTypeComment, getUserDefinedTypeExporter, getVersion, getWriteRowLockStrategy, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, isJdbcLogWarningsEnabledByDefault, isLob, openQuote, ordinal, prependComment, quote, registerDefaultKeywords, registerKeyword, registerKeywords, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, requiresColumnListInCreateView, requiresFloatCastingOfIntegerDivision, requiresParensForTupleCounts, resolveSqlTypeCode, resolveSqlTypeLength, stripsTrailingSpacesFromChar, supportsBatchUpdates, supportsBindAsCallableArgument, supportsBindingNullForSetObject, supportsBitType, supportsCascadeDelete, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsCrossJoin, supportsDuplicateSelectItemsInQueryGroup, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsForUpdate, supportsFractionalTimestampArithmetic, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsInsertReturningGeneratedKeys, supportsInsertReturningRowId, supportsIntersect, supportsJoinInMutationStatementSubquery, supportsJoinsInDelete, supportsLockTimeouts, supportsNamedColumnCheck, supportsNamedParameters, supportsNationalizedMethods, supportsNestedSubqueryCorrelation, supportsNestedWithClause, supportsNoColumnsInsert, supportsNoWait, supportsNullPrecedence, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsPredicateAsExpression, supportsRefCursors, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowValueConstructorDistinctFromSyntax, supportsRowValueConstructorGtLtSyntax, supportsRowValueConstructorSyntax, supportsRowValueConstructorSyntaxInInList, supportsRowValueConstructorSyntaxInInSubQuery, supportsRowValueConstructorSyntaxInQuantifiedPredicates, supportsSimpleQueryGrouping, supportsSkipLocked, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTableOptions, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleDistinctCounts, supportsUnionAll, supportsUnionInSubquery, supportsUpdateReturning, supportsValuesListForInsert, supportsWait, supportsWithClause, supportsWithClauseInSubquery, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, trimPattern, unquoteGetGeneratedKeys, useArrayForMultiValuedParameters, useCrossReferenceForeignKeys, useFollowOnLocking, useMaterializedLobWhenCapacityExceeded
-
Constructor Details
-
PostgresPlusDialect
public PostgresPlusDialect()Constructs a PostgresPlusDialect -
PostgresPlusDialect
-
PostgresPlusDialect
-
-
Method Details
-
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 classPostgreSQLDialect
-
-
castPattern
Description copied from class:DialectObtain a pattern for the SQL equivalent to acast()function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.- Overrides:
castPatternin classPostgreSQLDialect- Parameters:
from- aCastTypeindicating the type of the value argumentto- aCastTypeindicating the type the value argument is cast to
-
currentTimestamp
Description copied from class:DialectTranslation of the HQL/JPQLcurrent_timestampfunction, which maps to the Java typeTimestampwhich is a datetime with no time zone. This contradicts ANSI SQL wherecurrent_timestamphas the typeTIMESTAMP WITH TIME ZONE.It is recommended to override this in dialects for databases which support
localtimestamportimestamp at local.- Overrides:
currentTimestampin classPostgreSQLDialect
-
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 classPostgreSQLDialect- Parameters:
unit- the first argumentfromTemporalType- true if the first argument is a timestamp, false if a datetoTemporalType- true if the second argument is
-
isEmptyStringTreatedAsNull
public boolean isEmptyStringTreatedAsNull()Description copied from class:DialectReturn whether the dialect considers an empty string value to be null.- Overrides:
isEmptyStringTreatedAsNullin classDialect- Returns:
- boolean True if an empty string is treated as null, false otherwise.
-
registerResultSetOutParameter
Description copied from class:DialectRegisters a parameter capable of returning aResultSetby position, either anOUTparameter, or aREF_CURSORparameter as defined in Java 8.- Overrides:
registerResultSetOutParameterin classPostgreSQLDialect- 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.
-
getSelectGUIDString
Description copied from class:DialectGet the command used to select a GUID from the database.Optional operation.
- Overrides:
getSelectGUIDStringin classDialect- Returns:
- The appropriate command.
-
getSqlAstTranslatorFactory
Description copied from class:Dialect- Overrides:
getSqlAstTranslatorFactoryin classPostgreSQLDialect- See Also:
-