报错:org.hibernate.HibernateException: No Hibernate Session bound to thread

来源:互联网 发布:java 有序集合 编辑:程序博客网 时间:2024/05/21 08:11

org.hibernate.HibernateExceptionNo Hibernate Session bound to threadand configuration does not allow creation of non-transactional one here


【注】:解决:上面的代码是SpringMvc的工程,错误的原因是在Service类里的方法上面没有加
        @Transactional(readOnly = true, rollbackFor = Throwable.class)这个注释,没加这个注释导致拿
        不到Hibernate的Session。

原创粉丝点击