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 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.DB2FormatEmulation 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.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.PostgreSQLMinMaxFunction PostgreSQL doesn't support min/max for uuid yet, but since that type is comparable we want to support this operation.QuantifiedLeastGreatestEmulation SqlFunction A function to pass through a SQL fragment.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.TimestampaddFunction 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, char)
.