0 Replies Latest reply on Nov 7, 2006 9:25 AM by Markus Rabenberger

    Hibernate 3.2 aggregation functions change

    Markus Rabenberger Newbie

      Hi everyone,

      Hibernate3.2 Migration Guide http://www.hibernate.org/250.html#A42
      mentions "Changed aggregation (count, sum, avg) function return types".

      To use the classic pre Hibernate 3.2 aggregation functions, the following help is given:

      If you cannot change to the JPA compliant type handling the following code can be used to provide "classic" Hibernate behavior for HQL aggregation.

      Configuration classicCfg = new Configuration();
      classicCfg.addSqlFunction( "count", new ClassicCountFunction());
      classicCfg.addSqlFunction( "avg", new ClassicAvgFunction());
      classicCfg.addSqlFunction( "sum", new ClassicSumFunction());
      SessionFactory classicSf = classicCfg.buildSessionFactory();

      Is something like this also possible in declarative instead of programmatic configuration?

      My Hibernate configuration is deployed in JBoss AS 4.0.5 via a har archive, and i don´t know, how to switch to the old aggregation functions there.

      Thanks for your help.