/** * This method is called after the LocalSessionFactory is instantiated */ public void init() { // Provide backwards compatibility with Hibernate 3.1.x behavior for aggregate functions. Configuration config = getConfiguration(); config.addSqlFunction("count", new ClassicCountFunction()); config.addSqlFunction("avg", new ClassicAvgFunction()); config.addSqlFunction("sum", new ClassicSumFunction()); }
@Override protected void postProcessConfiguration(final Configuration config) throws HibernateException { // Set classic functions to return, ie, Integer on count, not Long // New to Hibernate 3.2, and would affect a large number of classes config.addSqlFunction("count", new ClassicCountFunction()); config.addSqlFunction("avg", new ClassicAvgFunction()); config.addSqlFunction("sum", new ClassicSumFunction()); }
public void configure(Configuration cfg) { super.configure( cfg ); cfg.addSqlFunction( "count", new ClassicCountFunction() ); cfg.addSqlFunction( "avg", new ClassicAvgFunction() ); cfg.addSqlFunction( "sum", new ClassicSumFunction() ); }