No value for key [org.hibernate.internal.SessionFactoryImpl@549efabc] bound to thread [http-nio-8080-exec-1]

造成这个问题直接原因是由于 SessionFactoryImpl 没有currentSession 这个属性或方法调用

 

问题最终原因spring 的orm框架中的 LocalSessionFactoryBean 和 HibernateTransactionManager 两个类版本不一致造成的

由于我用的一个是hibernate4 一个是hibernate5,所以当我把LocalSessionFactoryBean 的导入改成hiberante5就行了

import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.HibernateTransactionManager;

改为
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.orm.hibernate5.HibernateTransactionManager;

相关文章:

  • 2021-07-13
  • 2021-10-17
  • 2022-01-08
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2021-08-13
  • 2021-07-22
  • 2021-05-05
相关资源
相似解决方案