使用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>
出现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>
相关文章推荐
- [transaction] org.hibernate.HibernateException: createQuery is not valid without active transaction
- org.hibernate.HibernateException: createSQLQuery is not valid without active transaction
- org.hibernate.HibernateException: createSQLQuery is not valid without active transaction
- org.hibernate.HibernateException: getFlushMode is not valid without active transaction
- org.hibernate.HibernateException:*** is not valid without active transaction
- 使用spring4+springMVC+hibernate5 时报错:createQuery is not valid without active transaction;
- org.hibernate.HibernateException: save is not valid without active transaction
- spring整合hibernate的时候报异常org.hibernate.HibernateException: createQuery is not valid without active transaction
- Spring管理Hibernate 报 createQuery is not valid without active transaction 错误
- org.hibernate.HibernateException: delete is not valid without active transaction
- Exception in thread "main" org.hibernate.HibernateException: save is not valid without active transaction
- org.hibernate.HibernateException: save is not valid without active transaction
- 编程异常——假设你报createSQLQuery is not valid without active transaction,...
- Exception in thread "main" org.hibernate.HibernateException: get is not valid without active transac
- 编程异常——如果你报createSQLQuery is not valid without active transaction,...
- 错误createSQLQuery is not valid without active transaction
- createQuery is not valid without active transaction
- <转>如果你报createSQLQuery is not valid without active transaction,请看这里
- 异常积累(一)createQuery is not valid without active transaction
- createQuery is not valid without active transaction