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

后端 未结 5 2171
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:17

    Spring ignores hibernate.current_session_context_class=thread property (which you don't use) and wraps Hibernate’s SessionFactory in it's own transactional version as explained here

    The solution to this is to set the property

    false
    

    in session factory bean configuration

提交回复
热议问题