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