org.hibernate.sql
Class Template

java.lang.Object
  extended by org.hibernate.sql.Template

public final class Template
extends Object

Parses SQL fragments specified in mapping documents


Nested Class Summary
static class Template.NoOpColumnMapper
           
 
Field Summary
static OrderByAliasResolver LEGACY_ORDER_BY_ALIAS_RESOLVER
           
static String TEMPLATE
           
 
Method Summary
static String renderOrderByStringTemplate(String orderByFragment, ColumnMapper columnMapper, SessionFactoryImplementor sessionFactory, Dialect dialect, SQLFunctionRegistry functionRegistry)
           
static String renderOrderByStringTemplate(String orderByFragment, Dialect dialect, SQLFunctionRegistry functionRegistry)
          Deprecated. Use translateOrderBy(java.lang.String, org.hibernate.sql.ordering.antlr.ColumnMapper, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.dialect.Dialect, org.hibernate.dialect.function.SQLFunctionRegistry) instead
static String renderWhereStringTemplate(String sqlWhereString, Dialect dialect, SQLFunctionRegistry functionRegistry)
           
static String renderWhereStringTemplate(String sqlWhereString, String placeholder, Dialect dialect)
          Deprecated. Only intended for annotations usage; use renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry) instead
static String renderWhereStringTemplate(String sqlWhereString, String placeholder, Dialect dialect, SQLFunctionRegistry functionRegistry)
          Takes the where condition provided in the mapping attribute and interpolates the alias.
static OrderByTranslation translateOrderBy(String orderByFragment, ColumnMapper columnMapper, SessionFactoryImplementor sessionFactory, Dialect dialect, SQLFunctionRegistry functionRegistry)
          Performs order-by template rendering allowing column mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final String TEMPLATE
See Also:
Constant Field Values

LEGACY_ORDER_BY_ALIAS_RESOLVER

public static OrderByAliasResolver LEGACY_ORDER_BY_ALIAS_RESOLVER
Method Detail

renderWhereStringTemplate

public static String renderWhereStringTemplate(String sqlWhereString,
                                               Dialect dialect,
                                               SQLFunctionRegistry functionRegistry)

renderWhereStringTemplate

@Deprecated
public static String renderWhereStringTemplate(String sqlWhereString,
                                                          String placeholder,
                                                          Dialect dialect)
Deprecated. Only intended for annotations usage; use renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry) instead

Same functionality as renderWhereStringTemplate(String, String, Dialect, SQLFunctionRegistry), except that a SQLFunctionRegistry is not provided (i.e., only the dialect-defined functions are considered). This is only intended for use by the annotations project until the many-to-many/map-key-from-target-table feature is pulled into core.


renderWhereStringTemplate

public static String renderWhereStringTemplate(String sqlWhereString,
                                               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

renderOrderByStringTemplate

@Deprecated
public static String renderOrderByStringTemplate(String orderByFragment,
                                                            Dialect dialect,
                                                            SQLFunctionRegistry functionRegistry)
Deprecated. Use translateOrderBy(java.lang.String, org.hibernate.sql.ordering.antlr.ColumnMapper, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.dialect.Dialect, org.hibernate.dialect.function.SQLFunctionRegistry) instead

Performs order-by template rendering without column mapping. An ORDER BY template has all column references "qualified" with a placeholder identified by TEMPLATE

Parameters:
orderByFragment - The order-by fragment to render.
dialect - The SQL dialect being used.
functionRegistry - The SQL function registry
Returns:
The rendered ORDER BY template.

renderOrderByStringTemplate

public static String renderOrderByStringTemplate(String orderByFragment,
                                                 ColumnMapper columnMapper,
                                                 SessionFactoryImplementor sessionFactory,
                                                 Dialect dialect,
                                                 SQLFunctionRegistry functionRegistry)

translateOrderBy

public static OrderByTranslation translateOrderBy(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.


Copyright © 2001-2015 Red Hat, Inc. All Rights Reserved.