Package org.hibernate.dialect.function
Class PostgreSQLTruncRoundFunction
java.lang.Object
org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor
org.hibernate.dialect.function.PostgreSQLTruncRoundFunction
- All Implemented Interfaces:
FunctionRenderer,SqmFunctionDescriptor
public class PostgreSQLTruncRoundFunction
extends AbstractSqmFunctionDescriptor
implements FunctionRenderer
PostgreSQL only supports the two-argument
trunc and round functions
with the following signatures:
trunc(numeric, integer)round(numeric, integer)
This custom function falls back to using floor as a workaround only when necessary,
e.g. when there are 2 arguments to the function and either:
- The first argument is not of type
numeric
or
- The dialect doesn't support the two-argument
truncfunction
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine) Return an SQM node or subtree representing an invocation of this function with the given arguments.voidrender(SqlAppender sqlAppender, List<? extends SqlAstNode> arguments, ReturnableType<?> returnType, SqlAstTranslator<?> walker) Methods inherited from class org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor
generateAggregateSqmExpression, generateOrderedSetAggregateSqmExpression, generateSqmAggregateFunctionExpression, generateSqmExpression, generateSqmOrderedSetAggregateFunctionExpression, generateSqmWindowFunctionExpression, generateWindowSqmExpression, getArgumentsValidator, getArgumentTypeResolver, getName, getReturnSignature, getReturnTypeResolver, getSignatureMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.query.sqm.function.FunctionRenderer
render, render, render, renderMethods inherited from interface org.hibernate.query.sqm.function.SqmFunctionDescriptor
alwaysIncludesParentheses, generateSqmExpression, generateSqmExpression, getFunctionKind, isPredicate
-
Constructor Details
-
PostgreSQLTruncRoundFunction
-
-
Method Details
-
render
public void render(SqlAppender sqlAppender, List<? extends SqlAstNode> arguments, ReturnableType<?> returnType, SqlAstTranslator<?> walker) - Specified by:
renderin interfaceFunctionRenderer
-
getArgumentListSignature
- Overrides:
getArgumentListSignaturein classAbstractSqmFunctionDescriptor
-
generateSqmFunctionExpression
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine) Description copied from class:AbstractSqmFunctionDescriptorReturn an SQM node or subtree representing an invocation of this function with the given arguments. This method may be overridden in the case of function descriptors that wish to customize creation of the node.- Specified by:
generateSqmFunctionExpressionin classAbstractSqmFunctionDescriptor- Parameters:
arguments- the arguments of the function invocationimpliedResultType- the function return type as inferred from its usage
-