Package org.hibernate.dialect.function
Class AvgWithArgumentCastFunction
- java.lang.Object
-
- org.hibernate.dialect.function.StandardSQLFunction
-
- org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction
-
- org.hibernate.dialect.function.AvgWithArgumentCastFunction
-
- All Implemented Interfaces:
SQLFunction
public class AvgWithArgumentCastFunction extends StandardAnsiSqlAggregationFunctions.AvgFunction
Some databases strictly return the type of the aggregation value for AVG which is problematic in the case of averaging integers because the decimals will be dropped. The usual workaround is to cast the integer argument as some form of double/decimal.
-
-
Field Summary
-
Fields inherited from class org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction
INSTANCE
-
-
Constructor Summary
Constructors Constructor Description AvgWithArgumentCastFunction(java.lang.String castType)
Constructs a AvgWithArgumentCastFunction
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
renderArgument(java.lang.String argument, int firstArgumentJdbcType)
-
Methods inherited from class org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction
determineJdbcTypeCode, render, render
-
Methods inherited from class org.hibernate.dialect.function.StandardSQLFunction
getName, getRenderedName, getReturnType, getType, hasArguments, hasParenthesesIfNoArguments, toString
-
-
-
-
Method Detail
-
renderArgument
protected java.lang.String renderArgument(java.lang.String argument, int firstArgumentJdbcType)
- Overrides:
renderArgument
in classStandardAnsiSqlAggregationFunctions.AvgFunction
-
-