Ok, here is a more detailed look at your config. Thanks for compiling it for one bean. This makes analysis easier. ^^
There is a view of thisss amiss:
You will give sessionFactory two configurations at a time for a JDBC connection. Enter the dataSource.
<property name="dataSource" ref="ReferentielWebDevDataSource" />
And once, setting the properties in sessionFactory:
<property name="connection.driver_class"> <value>${jdbc.driverClassName}</value> </property> <property name="connection.url"> <value>${jdbc.databaseurl}</value> </property> <property name="connection.username"> <value>${jdbc.username}</value> </property> <property name="connection.password"> <value>${jdbc.password}</value> </property>
Only one of them is necessary, since each will launch another ConnectionProvider, which will be used by Hibernate. (I don't know if this is an inevitable problem or how is it a priority, but still this is a possible point of failure)
Then, the second cache is disabled and the current context is set up, although this may have reasons for getting started. I would put it as simple as possible and not leave them.
And finally, in this setting there are no Transaction Manager settings in the settings:
<property name="transaction.factory_class"> <value>org.hibernate.transaction.JDBCTransactionFactory</value> </property>
Since you have a HibernatTransactionManager bean:
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean>
So, we have two configurations fighting. The way Spring Hibernate Configuration works is that the DataSource is injected into the sessionFactory and sessionFactory in the TransactionManager. (I could try to find a link to this if necessary)
Ok, and to finish it all, I want to simplify the configuration:
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="ReferentielWebDevDataSource" /> <property name="hibernate.show_sql"> <value>true</value> </property> <property name="dialect"> <value>${jdbc.dialect}</value> </property> <property name="annotatedClasses"> <list> <value>com.it.model.application</value> </list> </property> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean>