Class SQLFunctionTemplate

  • All Implemented Interfaces:
    SQLFunction

    public class SQLFunctionTemplate
    extends java.lang.Object
    implements SQLFunction
    Represents HQL functions that can have different representations in different SQL dialects where that difference can be handled via a template/pattern.

    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).

    • Constructor Detail

      • SQLFunctionTemplate

        public SQLFunctionTemplate​(Type type,
                                   java.lang.String template)
        Constructs a SQLFunctionTemplate
        Parameters:
        type - The functions return type
        template - The function template
      • SQLFunctionTemplate

        public SQLFunctionTemplate​(Type type,
                                   java.lang.String template,
                                   boolean hasParenthesesIfNoArgs)
        Constructs a SQLFunctionTemplate
        Parameters:
        type - The functions return type
        template - The function template
        hasParenthesesIfNoArgs - If there are no arguments, are parentheses required?