E.g. in HQL we can define function concat(?1, ?2) to concatenate two strings
p1 and p2. Dialects would register different versions of this class *using the same name* (concat) but with
different templates or patterns; (?1 || ?2) for Oracle, concat(?1, ?2) for MySql,
(?1 + ?2) for MS SQL. Each dialect will define a template as a string (exactly like above) marking function
parameters with '?' followed by parameter's index (first index is 1).
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final TemplateRenderer | |
| private final Type |
| Access | Constructor and Description |
|---|---|
| public | SQLFunctionTemplate(Type
The functions return type type, String The function template template)Constructs a SQLFunctionTemplate |
| public | SQLFunctionTemplate(Type
The functions return type type, String The function template template, boolean If there are no arguments, are parentheses required? hasParenthesesIfNoArgs)Constructs a SQLFunctionTemplate |
| Modifier and Type | Method and Description |
|---|---|
| public Type | getReturnType(Type
The type of the first argument argumentType, Mapping The mapping source. mapping)Implements org. |
| public boolean | hasArguments()
Implements org. |
| public boolean | hasParenthesesIfNoArguments()
Implements org. |
| public String | render(Type
The type of the first argument argumentType, List<E> The function arguments args, SessionFactoryImplementor The SessionFactory factory)Implements org.
Deprecated
as a consequence of
Render the function call as SQL fragment.
SessionFactoryImplementor being deprecated.
|
| public String |
| hasParenthesesIfNoArgs | back to summary |
|---|---|
| private final boolean hasParenthesesIfNoArgs | |
| renderer | back to summary |
|---|---|
| private final TemplateRenderer renderer | |
| type | back to summary |
|---|---|
| private final Type type | |
| SQLFunctionTemplate | back to summary |
|---|---|
| public SQLFunctionTemplate(Type type, String template) Constructs a SQLFunctionTemplate | |
| SQLFunctionTemplate | back to summary |
|---|---|
| public SQLFunctionTemplate(Type type, String template, boolean hasParenthesesIfNoArgs) Constructs a SQLFunctionTemplate | |
| getReturnType | back to summary |
|---|---|
| public Type getReturnType(Type argumentType, Mapping mapping) throws QueryException Implements org. Doc from org. The return type of the function. May be either a concrete type which is preset, or variable depending upon the type of the first function argument.
Note, the 'firstArgumentType' parameter should match the one passed into
| |
| hasArguments | back to summary |
|---|---|
| public boolean hasArguments() Implements org. Doc from org. Does this function have any arguments?
| |
| hasParenthesesIfNoArguments | back to summary |
|---|---|
| public boolean hasParenthesesIfNoArguments() Implements org. Doc from org. If there are no arguments, are parentheses required?
| |
| render | back to summary |
|---|---|
| public String render(Type argumentType, List<E> args, SessionFactoryImplementor factory) Implements org. Doc from org. Deprecated as a consequence of Render the function call as SQL fragment.
Note, the 'firstArgumentType' parameter should match the one passed into
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |