Infrastructure
-
Currently I have implemented a repository layer based on
HibernateDaoSupport. I create aSessionFactoryby using Spring’sAnnotationSessionFactoryBean. How do I get Spring Data repositories working in this environment?You have to replace
AnnotationSessionFactoryBeanwith theHibernateJpaSessionFactoryBean, as follows:Example 1. Looking up aSessionFactoryfrom aHibernateEntityManagerFactory<bean id="sessionFactory" class="org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean>