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

org.hibernate.HibernateException: createSQLQuery is not valid without active transaction

2013-10-25 16:28 453 查看
org.hibernate.HibernateException: createSQLQuery is not valid without active transaction

异常解决: 产生这个异常的原因是代码中使用了如下片段:

public class ConfigDaoImpl extends HibernateBaseTemplate implements ConfigDao {.........

this.getHibernateTemplate().getSessionFactory().getCurrentSession();

 

=====================

由于配置文件中是如下的用法:

   <property name="current_session_context_class">thread</property>

如果改为:

  <property name="current_session_context_class">jta</property>

则没问题.

[参照:http://blog.csdn.net/yinjian520/article/details/8666695]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: