Class CurrentFunction

All Implemented Interfaces:
FunctionRenderer, SqmFunctionDescriptor

public class CurrentFunction extends AbstractSqmSelfRenderingFunctionDescriptor
A "function" with no parameters that returns the current date, time, or timestamp. For example, current_date.
  • Constructor Details

  • Method Details

    • render

      public void render(SqlAppender sqlAppender, List<? extends SqlAstNode> arguments, ReturnableType<?> returnType, SqlAstTranslator<?> walker)
      Specified by:
      render in interface FunctionRenderer
      Overrides:
      render in class AbstractSqmSelfRenderingFunctionDescriptor
    • getArgumentListSignature

      public String getArgumentListSignature()
      Overrides:
      getArgumentListSignature in class AbstractSqmFunctionDescriptor
    • alwaysIncludesParentheses

      public boolean alwaysIncludesParentheses()
      Description copied from interface: SqmFunctionDescriptor
      Will a call to the described function always include parentheses?

      Instances of this interface are usually used for rendering of functions. However, there are cases where Hibernate needs to consume a fragment and decide if a token represents a function name. In cases where the token is followed by an opening parenthesis, we can safely assume the token is a function name. Bur if the next token is not an opening parenthesis, the token might still represent a function if the function has a "no paren" form in the case of no arguments.

      For example, many databases do not require parentheses for functions like current_timestamp and friends. This method helps account for those cases.

      Returns:
      true by default