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

public Class AvgWithArgumentCastFunction

extends AvgFunction
Class Inheritance
Imports
java.sql.Types

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.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final String
Inherited from org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction:
INSTANCE

Constructor Summary

AccessConstructor and Description
public
AvgWithArgumentCastFunction(String
The type to cast the avg argument to
castType
)

Constructs a AvgWithArgumentCastFunction

Method Summary

Modifier and TypeMethod and Description
protected String
Inherited from org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction:
determineJdbcTypeCoderenderrender

Field Detail

castTypeback to summary
private final String castType

Constructor Detail

AvgWithArgumentCastFunctionback to summary
public AvgWithArgumentCastFunction(String castType)

Constructs a AvgWithArgumentCastFunction

Parameters
castType:String

The type to cast the avg argument to

Method Detail

renderArgumentback to summary
protected String renderArgument(String argument, int firstArgumentJdbcType)

Overrides org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions.AvgFunction.renderArgument.

Annotations
@Override