Interface SqmSetReturningFunctionDescriptor
- All Known Implementing Classes:
AbstractSqmSelfRenderingSetReturningFunctionDescriptor
,AbstractSqmSetReturningFunctionDescriptor
,CockroachDBJsonTableFunction
,CteGenerateSeriesFunction
,DB2JsonTableFunction
,DB2UnnestFunction
,DB2XmlTableFunction
,GenerateSeriesFunction
,H2GenerateSeriesFunction
,H2JsonTableFunction
,H2UnnestFunction
,HANAGenerateSeriesFunction
,HANAJsonTableFunction
,HANAUnnestFunction
,HANAXmlTableFunction
,JsonTableFunction
,MySQLJsonTableFunction
,NamedSqmSetReturningFunctionDescriptor
,NumberSeriesGenerateSeriesFunction
,OracleJsonTableFunction
,OracleUnnestFunction
,OracleXmlTableFunction
,PostgreSQLJsonTableFunction
,PostgreSQLUnnestFunction
,SQLServerGenerateSeriesFunction
,SQLServerJsonTableFunction
,SQLServerUnnestFunction
,SQLServerXmlTableFunction
,SybaseASEGenerateSeriesFunction
,SybaseASEUnnestFunction
,SybaseASEXmlTableFunction
,UnnestFunction
,XmlTableFunction
When a function call is encountered in the text of an HQL query,
a SqmSetReturningFunctionDescriptor
for the given name is obtained
from the SqmFunctionRegistry
, and the
generateSqmExpression(java.util.List<? extends org.hibernate.query.sqm.tree.SqmTypedNode<?>>, org.hibernate.query.spi.QueryEngine)
method is called with SQM nodes
representing the invocation arguments. It is the responsibility
of the SqmSetReturningFunctionDescriptor
to produce a subtree of SQM
nodes representing the function invocation.
The resulting subtree might be quite complex, since the
SqmSetReturningFunctionDescriptor
is permitted to perform syntactic
de-sugaring. On the other hand, generateSqmExpression(java.util.List<? extends org.hibernate.query.sqm.tree.SqmTypedNode<?>>, org.hibernate.query.spi.QueryEngine)
returns SelfRenderingSqmSetReturningFunction
, which is an object
that is permitted to take over the logic of producing the
SQL AST subtree, so de-sugaring may also be performed there.
User-written function descriptors may be contributed via a
FunctionContributor
.
The SqmFunctionRegistry
exposes methods which simplify
the definition of a function, including
SqmFunctionRegistry.namedSetReturningDescriptorBuilder(String, SetReturningFunctionTypeResolver)
.
- Since:
- 7.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongenerateSqmExpression
(List<? extends SqmTypedNode<?>> arguments, QueryEngine queryEngine) Instantiate this template with the given arguments and.The object responsible for validating arguments of the function.default String
getSignature
(String name) Used only for pretty-printing the function signature in the log.
-
Method Details
-
generateSqmExpression
<T> SelfRenderingSqmSetReturningFunction<T> generateSqmExpression(List<? extends SqmTypedNode<?>> arguments, QueryEngine queryEngine) Instantiate this template with the given arguments and. This produces a tree of SQM nodes representing a tree of function invocations. This allows a single HQL function to be defined in terms of other predefined (database independent) HQL functions, simplifying the task of writing HQL functions which are portable between databases. -
getSignature
Used only for pretty-printing the function signature in the log.- Parameters:
name
- the function name- Returns:
- the signature of the function
-
getArgumentsValidator
ArgumentsValidator getArgumentsValidator()The object responsible for validating arguments of the function.- Returns:
- an instance of
ArgumentsValidator
-