Class Template


  • public final class Template
    extends java.lang.Object
    Parses SQL fragments specified in mapping documents
    • Method Detail

      • renderTransformerReadFragment

        public static java.lang.String renderTransformerReadFragment​(java.lang.String fragment,
                                                                     java.lang.String... columnNames)
      • renderWhereStringTemplate

        public static java.lang.String renderWhereStringTemplate​(java.lang.String sqlWhereString,
                                                                 Dialect dialect,
                                                                 SQLFunctionRegistry functionRegistry)
      • renderWhereStringTemplate

        public static java.lang.String renderWhereStringTemplate​(java.lang.String sqlWhereString,
                                                                 java.lang.String placeholder,
                                                                 Dialect dialect,
                                                                 SQLFunctionRegistry functionRegistry)
        Takes the where condition provided in the mapping attribute and interpolates the alias. Handles sub-selects, quoted identifiers, quoted strings, expressions, SQL functions, named parameters.
        Parameters:
        sqlWhereString - The string into which to interpolate the placeholder value
        placeholder - The value to be interpolated into the the sqlWhereString
        dialect - The dialect to apply
        functionRegistry - The registry of all sql functions
        Returns:
        The rendered sql fragment
      • translateOrderBy

        public static OrderByTranslation translateOrderBy​(java.lang.String orderByFragment,
                                                          ColumnMapper columnMapper,
                                                          SessionFactoryImplementor sessionFactory,
                                                          Dialect dialect,
                                                          SQLFunctionRegistry functionRegistry)
        Performs order-by template rendering allowing column mapping. An ORDER BY template has all column references "qualified" with a placeholder identified by TEMPLATE which can later be used to easily inject the SQL alias.
        Parameters:
        orderByFragment - The order-by fragment to render.
        columnMapper - The column mapping strategy to use.
        sessionFactory - The session factory.
        dialect - The SQL dialect being used.
        functionRegistry - The SQL function registry
        Returns:
        The rendered ORDER BY template.