您的位置:首页 > 产品设计 > UI/UE

使用S2SH框架时,出现org.hibernate.HibernateException: createQuery is not valid without active transaction

2017-03-02 08:11 561 查看
在使用ssh框架时,获取session对象使用的是sessionFactory.getCurrentSession()时,通过session调用save,update,delete,createQuery等方法时,

出现org.hibernate.HibernateException: createQuery is not valid without active transaction异常。

解决方法:在相应的配置文件中将

<property name="hibernate.current_session_context_class">

        therad
</property>

改成:

<property name="hibernate.current_session_context_class">

        org.springframework.orm.hibernate3.SpringSessionContext

</property>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐