报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transact

Posted cnsdhzzl

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transact相关的知识,希望对你有一定的参考价值。

大概分析一般使用了注解才会报这方面的错

1.没有在spring的ApplicationContext.xml中开启注解事务

<!-- 开启注解事务 -->
    <tx:annotation-driven transaction-manager="txManager"/>

2.没有在方法上挂注解事务标签

 

以上是关于报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transact的主要内容,如果未能解决你的问题,请参考以下文章

解决Hibernate:could not initialize proxy - no Session

懒加载的解决方法(全)org.hibernate.LazyInitializationException: could not initialize proxy - no Session

no session 问题出现的原因及解决方案

Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法(示例代码

bug记录jpa 解决org.hibernate.lazyinitializationexception could not initialize proxy - no session

HibernateException: No Hibernate Session bound to thread