Infrastructure

  1. Currently I have implemented a repository layer based on HibernateDaoSupport. I create a SessionFactory by using Spring’s AnnotationSessionFactoryBean. How do I get Spring Data repositories working in this environment?

    You have to replace AnnotationSessionFactoryBean with the HibernateJpaSessionFactoryBean, as follows:

    Example 1. Looking up a SessionFactory from a HibernateEntityManagerFactory
    <bean id="sessionFactory" class="org.springframework.orm.jpa.vendor.HibernateJpaSessionFactoryBean">
      <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>