Class PatternBasedSqmFunctionDescriptor

  • All Implemented Interfaces:
    FunctionRenderer, FunctionRenderingSupport, SqmFunctionDescriptor

    public class PatternBasedSqmFunctionDescriptor
    extends AbstractSqmSelfRenderingFunctionDescriptor
    Support for HQL functions that have different representations in different SQL dialects, where the difference can be handled via a pattern template.

    In HQL we might define a function concat(?1, ?2) to concatenate two strings p1 and p2. Dialects register different instances 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 SQL Server. Each dialect defines a template as a string exactly as shown above, marking each function parameter with '?' followed by the parameter index. Parameters are indexed from 1. The last parameter may be a vararg, indicated with the syntax (?1 || ?2...).