因此,我找到了适合我的解决方案。如果您正在使用配置.xml文件,则Mathias可能是正确的。但是对于那些使用application.properties文件的用户,您需要将此行添加到配置类或主应用程序类中:
@Bean public SessionFactory sessionFactory(HibernateEntityManagerFactory hemf){ return hemf.getSessionFactory(); }完成后,将此行添加到application.properties文件:
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
这个解决方案对我有用。这是我能够处理的其他参考:
http://www.ekiras.com/2016/02/how-to-use-configure-session-factory-bean-
springboot.html



