org.hibernate.HibernateException: No CurrentSessionContext configured!
错误,解决方法:
hibernate.cfg.xml中添加:
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
错误,解决方法:
hibernate.cfg.xml中添加:
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
本文介绍了解决Hibernate在运行时出现NoCurrentSessionContext异常的方法。通过在配置文件hibernate.cfg.xml中添加一行代码来启用Hibernate的自动会话上下文管理功能,从而避免了该异常的发生。
374

被折叠的 条评论
为什么被折叠?



