Another way similar to the yglodt's
In application.properties:
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
And in your configuration class:
@Bean
public SessionFactory sessionFactory(HibernateEntityManagerFactory hemf) {
return hemf.getSessionFactory();
}
Then you can autowire the SessionFactory in your services as usual:
@Autowired
private SessionFactory sessionFactory;