abiieez
abiieez

Reputation: 3189

Downgrade hibernate version

I have the following configuration based on Hibernate 4.1.7.Final

<bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager"
        p:sessionFactory-ref="sessionFactory" />

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
        p:packagesToScan="com.ucmas.cms.entity" p:dataSource-ref="dataSource">
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
    </bean>

However, now I would like to achieve the same result with hibernate 3.6.0.Final. May I know what the configuration should look like ? I tried to change the org.springframework.orm.hibernate4.LocalSessionFactoryBean to org.springframework.orm.hibernate3.LocalSessionFactoryBean, but it gives "no setter found for property" packagesToScan. Any help appreciated.

Upvotes: 1

Views: 666

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You need to use org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean instead of org.springframework.orm.hibernate3.LocalSessionFactoryBean.

In spring-hibernate3 annotations are not supported using the LocalSessionFactoryBean factory, for annotation support they have AnnotationSessionFactoryBean, but in hibernate4 support they have enabled it by default.

And need to use org.springframework.orm.hibernate3.HibernateTransactionManager transaction manager

Upvotes: 3

Related Questions