Top Description Inners Fields Constructors Methods
org.hibernate.dialect.function

public Class TruncFunction

extends AbstractSqmFunctionDescriptor
Class Inheritance
Known Direct Subclasses
org.hibernate.dialect.function.OracleTruncFunction, org.hibernate.dialect.function.PostgreSQLTruncFunction, org.hibernate.dialect.function.SqlServerConvertTruncFunction, org.hibernate.dialect.function.SybaseTruncFunction
Imports
java.util.ArrayList, .List, org.hibernate.query.ReturnableType, org.hibernate.query.spi.QueryEngine, org.hibernate.query.sqm.NodeBuilder, .TemporalUnit, org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor, .FunctionRenderer, .SelfRenderingSqmFunction, org.hibernate.query.sqm.produce.function.ArgumentTypesValidator, .ArgumentsValidator, .StandardArgumentsValidators, .StandardFunctionArgumentTypeResolvers, .StandardFunctionReturnTypeResolvers, org.hibernate.query.sqm.produce.function.internal.PatternRenderer, org.hibernate.query.sqm.tree.SqmTypedNode, org.hibernate.query.sqm.tree.expression.SqmExtractUnit, .SqmLiteral, org.hibernate.sql.ast.SqlAstTranslator, org.hibernate.sql.ast.spi.SqlAppender, org.hibernate.sql.ast.tree.SqlAstNode, org.hibernate.type.spi.TypeConfiguration

Custom function that manages both numeric and datetime truncation
Author
Marco Belladelli

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
protected static class
protected static class
TruncFunction.TruncRenderingSupport

Deprecated as a consequence of FunctionRenderer being deprecated.

Field Summary

Modifier and TypeField and Description
protected final TruncFunction.TruncRenderingSupport
datetimeRenderingSupport

Deprecated as a consequence of TruncFunction.TruncRenderingSupport being deprecated.
private final TruncFunction.DatetimeTrunc
private final DateTruncEmulation
dateTruncEmulation

Deprecated as a consequence of DateTruncEmulation being deprecated.
protected final TruncFunction.TruncRenderingSupport
numericRenderingSupport

Deprecated as a consequence of TruncFunction.TruncRenderingSupport being deprecated.

Constructor Summary

AccessConstructor and Description
public
TruncFunction(String truncPattern, String twoArgTruncPattern, TruncFunction.DatetimeTrunc datetimeTrunc, String toDateFunction, TypeConfiguration typeConfiguration)

Method Summary

Modifier and TypeMethod and Description
protected <T> SelfRenderingSqmFunction<T>
generateSqmFunctionExpression(List<? extends SqmTypedNode<?>>
the arguments of the function invocation
arguments
,
ReturnableType<T>
the function return type as inferred from its usage
impliedResultType
,
QueryEngine queryEngine)

Implements abstract org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor.generateSqmFunctionExpression.

Return an SQM node or subtree representing an invocation of this function with the given arguments.
Inherited from org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor:
generateAggregateSqmExpressiongenerateOrderedSetAggregateSqmExpressiongenerateSqmAggregateFunctionExpressiongenerateSqmExpressiongenerateSqmOrderedSetAggregateFunctionExpressiongenerateSqmWindowFunctionExpressiongenerateWindowSqmExpressiongetArgumentListSignaturegetArgumentsValidatorgetArgumentTypeResolvergetNamegetReturnSignaturegetReturnTypeResolvergetSignature

Field Detail

datetimeRenderingSupportback to summary
protected final TruncFunction.TruncRenderingSupport datetimeRenderingSupport

Deprecated

as a consequence of TruncFunction.TruncRenderingSupport being deprecated. See corresponding docs for further information.

datetimeTruncback to summary
private final TruncFunction.DatetimeTrunc datetimeTrunc
dateTruncEmulationback to summary
private final DateTruncEmulation dateTruncEmulation

Deprecated

as a consequence of DateTruncEmulation being deprecated. See corresponding docs for further information.

numericRenderingSupportback to summary
protected final TruncFunction.TruncRenderingSupport numericRenderingSupport

Deprecated

as a consequence of TruncFunction.TruncRenderingSupport being deprecated. See corresponding docs for further information.

Constructor Detail

TruncFunctionback to summary
public TruncFunction(String truncPattern, String twoArgTruncPattern, TruncFunction.DatetimeTrunc datetimeTrunc, String toDateFunction, TypeConfiguration typeConfiguration)

Method Detail

generateSqmFunctionExpressionback to summary
protected <T> SelfRenderingSqmFunction<T> generateSqmFunctionExpression(List<? extends SqmTypedNode<?>> arguments, ReturnableType<T> impliedResultType, QueryEngine queryEngine)

Implements abstract org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor.generateSqmFunctionExpression.

Doc from org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor.generateSqmFunctionExpression.

Return 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.

Parameters
arguments:List<? extends SqmTypedNode<?>>

the arguments of the function invocation

impliedResultType:ReturnableType<T>

the function return type as inferred from its usage

Annotations
@Override
org.hibernate.dialect.function back to summary

public final Enum TruncFunction.DatetimeTrunc

extends Enum<TruncFunction.DatetimeTrunc>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final TruncFunction.DatetimeTrunc
public static final TruncFunction.DatetimeTrunc
public static final TruncFunction.DatetimeTrunc
private final String
public static final TruncFunction.DatetimeTrunc

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
public static TruncFunction.DatetimeTrunc
public static TruncFunction.DatetimeTrunc[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DATE_TRUNCback to summary
public static final TruncFunction.DatetimeTrunc DATE_TRUNC
DATETRUNCback to summary
public static final TruncFunction.DatetimeTrunc DATETRUNC
FORMATback to summary
public static final TruncFunction.DatetimeTrunc FORMAT
patternback to summary
private final String pattern
TRUNCback to summary
public static final TruncFunction.DatetimeTrunc TRUNC

Constructor Detail

DatetimeTruncback to summary
private DatetimeTrunc(String pattern)

Method Detail

getPatternback to summary
public String getPattern()
valueOfback to summary
public static TruncFunction.DatetimeTrunc valueOf(String name)
valuesback to summary
public static TruncFunction.DatetimeTrunc[] values()
org.hibernate.dialect.function back to summary

protected Class TruncFunction.TruncArgumentsValidator

extends Object
implements ArgumentsValidator
Class Inheritance
  • java.lang.Object
  • org.hibernate.dialect.function.TruncFunction.TruncArgumentsValidator
All Implemented Interfaces
org.hibernate.query.sqm.produce.function.ArgumentsValidator

Field Summary

Modifier and TypeField and Description
protected static final ArgumentTypesValidator
protected static final ArgumentTypesValidator

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
validate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration)

Overrides default org.hibernate.query.sqm.produce.function.ArgumentsValidator.validate.

Perform validation that may be done using the SqmTypedNode tree and assigned Java types.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DATETIME_VALIDATORback to summary
protected static final ArgumentTypesValidator DATETIME_VALIDATOR
NUMERIC_VALIDATORback to summary
protected static final ArgumentTypesValidator NUMERIC_VALIDATOR

Constructor Detail

TruncArgumentsValidatorback to summary
protected TruncArgumentsValidator()

Method Detail

validateback to summary
public void validate(List<? extends SqmTypedNode<?>> arguments, String functionName, TypeConfiguration typeConfiguration)

Overrides default org.hibernate.query.sqm.produce.function.ArgumentsValidator.validate.

Doc from org.hibernate.query.sqm.produce.function.ArgumentsValidator.validate.

Perform validation that may be done using the SqmTypedNode tree and assigned Java types.

Annotations
@Override
org.hibernate.dialect.function back to summary

protected Class TruncFunction.TruncRenderingSupport

extends Object
implements FunctionRenderer
Class Inheritance
  • java.lang.Object
  • org.hibernate.dialect.function.TruncFunction.TruncRenderingSupport
All Implemented Interfaces
org.hibernate.query.sqm.function.FunctionRenderer, org.hibernate.query.sqm.function.FunctionRenderingSupport

Deprecated

as a consequence of FunctionRenderer being deprecated. See corresponding docs for further information.

Field Summary

Modifier and TypeField and Description
private final PatternRenderer
private final PatternRenderer

Constructor Summary

AccessConstructor and Description
public
TruncRenderingSupport(PatternRenderer truncPattern, PatternRenderer twoArgTruncPattern)

Method Summary

Modifier and TypeMethod and Description
public void
render(SqlAppender sqlAppender, List<? extends SqlAstNode> sqlAstArguments, ReturnableType<?> returnType, SqlAstTranslator<?> walker)

Implements org.hibernate.query.sqm.function.FunctionRenderer.render.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

truncPatternback to summary
private final PatternRenderer truncPattern
twoArgTruncPatternback to summary
private final PatternRenderer twoArgTruncPattern

Constructor Detail

TruncRenderingSupportback to summary
public TruncRenderingSupport(PatternRenderer truncPattern, PatternRenderer twoArgTruncPattern)

Method Detail

renderback to summary
public void render(SqlAppender sqlAppender, List<? extends SqlAstNode> sqlAstArguments, ReturnableType<?> returnType, SqlAstTranslator<?> walker)

Implements org.hibernate.query.sqm.function.FunctionRenderer.render.

Annotations
@Override