Package org.hibernate.dialect.function
Contains implementations of
SqmFunctionDescriptor
describing a range of relatively-sophisticated SQL functions available in various dialects.-
Class Summary Class Description AggregateWindowEmulationQueryTransformer Since the query spec will render a hypothetical set window function instead of an aggregate, the following query transformer will wrap the query spec and apply aggregation in the outer query.AvgFunction AvgFunction.ReturnTypeResolver AvgFunction.Validator CaseLeastGreatestEmulation Some databases don't have a function likeleast()
orgreatest()
, and on those platforms we emulate the function usingcase
.CastFunction ANSI SQL-inspiredcast()
function, where the target types are enumerated byCastType
, and portability is achieved by delegating toDialect.castPattern(CastType, CastType)
.CastingConcatFunction CastStrEmulation The HQLstr()
function is now considered a synonym forcast(x as String)
.ChrLiteralEmulation A chr implementation that translates integer literals to string literals.CoalesceIfnullEmulation CommonFunctionFactory Enumeratoes common function template definitions.ConcatPipeFunction A concat function with a pattern for clob arguments.CountFunction CurrentFunction A "function" with no parameters that returns the current date, time, or timestamp.DateTruncEmulation Emulation oftrunc(datetime, temporal_unit)
function that leverages formatting the datetime to string and back to truncate itDB2FormatEmulation DB2's varchar_format() can't handle quoted literal strings in the format pattern.DB2PositionFunction DB2's position() function always requires a code unit before version 11.DB2SubstringFunction DB2's substring() function requires a code unit and substr() can't optionally take it, so we render substr() by default.DerbyLpadEmulation A derby implementation for lpad.DerbyRpadEmulation A derby implementation for rpad.DynamicDispatchFunction A function that dynamically dispatches to other functions, depending on which function validates successfully first.EveryAnyEmulation Most databases don't have a function likeevery()
orany()
.ExtractFunction ANSI SQL-inspiredextract()
function, where the date/time fields are enumerated byTemporalUnit
, and portability is achieved by delegating toDialect.extractPattern(TemporalUnit)
.FormatFunction A format function with support for composite temporal expressions.FormatFunction.FormatSqmFunction<T> HypotheticalSetFunction HypotheticalSetWindowEmulation InsertSubstringOverlayEmulation Emulates the ANSI SQL-standardoverlay()
function usinginsert()
substring()
, andconcat()
.IntegralTimestampaddFunction Used in place ofTimestampaddFunction
for databases which don't support fractional seconds in thetimestampadd()
function.InverseDistributionFunction InverseDistributionWindowEmulation LengthFunction A length function with separate patterns for string and clob argument.ListaggFunction ListaggGroupConcatEmulation ListaggStringAggEmulation LocatePositionEmulation Emulates the ANSI SQL-standardposition()
function usinglocate()
.LpadRpadPadEmulation HQL function inspired by the ANSI SQL trim function, with a funny syntax involving aTrimSpec
.MinMaxCaseEveryAnyEmulation Most databases don't have a function likeevery()
orany()
.ModeStatsModeEmulation NvlCoalesceEmulation Oracle 8i had nocoalesce()
function, so we emulate it using chainednvl()
s.OracleTruncFunction CustomTruncFunction
for Oracle which uses emulation when truncating datetimes to secondsPostgreSQLMinMaxFunction PostgreSQL doesn't support min/max for uuid yet, but since that type is comparable we want to support this operation.PostgreSQLTruncFunction CustomTruncFunction
for PostgreSQL which uses the dialect-specific function for numeric truncationPostgreSQLTruncRoundFunction PostgreSQL only supports the two-argumenttrunc
andround
functions with the following signatures:trunc(numeric, integer)
round(numeric, integer)
QuantifiedLeastGreatestEmulation SqlColumn SqlFunction A function to pass through a SQL fragment.SqlServerConvertTruncFunction CustomTruncFunction
for SQL Server versions before 16, which uses the customSqlServerConvertTruncFunction.DateTruncConvertEmulation
SQLServerEveryAnyEmulation SQL Server doesn't have a function likeevery()
orany()
.SQLServerFormatEmulation SQL Server behaves strangely when the first argument to format is of the type time, so we cast to datetime.StandardSQLFunction Simplified API allowing users to contributeSqmFunctionDescriptor
s to HQL.SumReturnTypeResolver Resolve according to JPA spec 4.8.5SybaseTruncFunction CustomTruncFunction
for Sybase which uses a dialect-specific emulation function for datetimesTimestampaddFunction Thetimestampadd()
ordateadd()
function has a funny syntax which accepts aTemporalUnit
as the first argument, and the actual set of accepted units varies widely.TimestampdiffFunction Thetimestampdiff()
ordatediff()
function has a funny syntax which accepts aTemporalUnit
as the first argument, and the actual set of accepted units varies widely.TransactSQLStrFunction A special function that renders a T-SQLstr()
function if more than a single argument is given, or otherwise renders acast()
expression just likeCastStrEmulation
.TrimFunction ANSI SQL-standardtrim()
function, which has a funny syntax involving aTrimSpec
, and portability is achieved usingDialect.trimPattern(TrimSpec, boolean)
.TruncFunction Custom function that manages both numeric and datetime truncationTruncFunction.TruncArgumentsValidator TruncFunction.TruncRenderingSupport -
Enum Summary Enum Description TruncFunction.DatetimeTrunc