Spring / Hibernate / JUnit - No Hibernate Session bound to Thread

后端 未结 5 2163
Happy的楠姐
Happy的楠姐 2020-12-14 18:37

I\'m trying to access the current hibernate session in a test case, and getting the following error:

org.hibernate.HibernateException: No Hibernate

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 19:02

    Duh.

    Session session = sessionFactory.openSession();

    Session session = sessionFactory.getCurrentSession();
    

    Oops.

    (Edited since this was wrong, and getting upvoted).

提交回复
热议问题