Java Hibernate:保持Hibernate 3.2中聚合函数的兼容性

Java Hibernate:保持Hibernate 3.2中聚合函数的兼容性,java,spring,hibernate,aggregate,Java,Spring,Hibernate,Aggregate,最近我将我的应用程序从Hibernate3.1迁移到3.2。 但我在使用聚合函数(count、avg…)时遇到一些强制转换异常 因此,我想知道如何保持我的代码与新版本的hibernate的兼容性? 例如在SessionFactorybean的配置中进行一些更改: <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" single

最近我将我的应用程序从Hibernate3.1迁移到3.2。 但我在使用聚合函数(count、avg…)时遇到一些强制转换异常

因此,我想知道如何保持我的代码与新版本的hibernate的兼容性? 例如在SessionFactorybean的配置中进行一些更改:

<bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
        singleton="true">
        <property name="mappingResources">
            <list>
                <value>
                    hibernate/mapping/Domain.hbm.xml
                </value>
                <value>
                    hibernate/mapping/EpAttributeDef.hbm.xml
                </value>
                <value>
                    hibernate/mapping/Activity.hbm.xml
                </value>
....
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.OracleDialect
                </prop>

                <prop key="hibernate.cache.provider_class">
                    org.hibernate.cache.HashtableCacheProvider
                </prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.use_sql_comments">true</prop>
                <prop key="hibernate.jdbc.batch_size">0</prop>
            </props>
        </property>
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
    </bean>

hibernate/mapping/Domain.hbm.xml
hibernate/mapping/epattributeef.hbm.xml
hibernate/mapping/Activity.hbm.xml
....
org.hibernate.dialen.oraclealent
org.hibernate.cache.HashtableCacheProvider
假的
真的
0

这里提供了一种解决方案:

因此SessionFactoryBean的类将是ClassicLocalSessionFactoryBeanHibernate31,而不是LocalSessionFactoryBean