Reconfiguring application context configuration on Spring 3.1 and Hibernate 4.0

I find it difficult to find documents for migration. I used sping 3.0.5 and hibernate 3.4.

I moved on to the latest release candidates: spring 3.1 and hibernate 4.0

I managed to reorganize my classes without problems, but the application context for hibernate gives me problems, since I do not see examples of how to configure it.

In particular:

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mappingResources"> <list>...</list> </property> <property name="hibernateProperties"> <props> ... <prop key="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</prop> <prop key="hibernate.cache.provider_class">????</prop> ... </props> </property> </bean> 

Apparently, the dataSource , mappingResources and hibernateProperties properties no longer exist, and I'm not sure what to put in hibernate.connection.provider_class and hibernate.cache.provider_class .

And I keep getting:

 Caused by: java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition 

when you start the application.

+4
source share
2 answers

As far as I know, Spring does not support Hibernate 4. If that were the case, I expected to see the org.springframework.orm.hibernate4 package in the 3.1.x package list , but it is not. I do not think I saw any mention of this in any release notes or anything else.

In other words, Spring is working fine, but you are using an incompatible version of Hibernate.

+4
source

dataSource still exists based on JavaDoc for LocalSessionFactoryBean . See the section at the top; it has an example configuration with the dataSource property. mappingResources also exists.

Spring 3.1 also has an example with dataSource and mappingResources .

Hibernate 4 has no link yet.

0
source

All Articles