码迷,mamicode.com
首页 > 其他好文 > 详细

整合ssh事务问题

时间:2015-01-05 07:12:56      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:ssh   事务   

org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
	org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
  1. 1. 如果想让spring帮你管理事务,只能在spring中配置SessionFactory。如果使用hibernate原有的sessionFactory,则只能自己手动管理事务。  

  2. 如果想使用sessionFactory.getCurrentSession()方法,必须配置sessionFactory和jta或thread绑定。但是hibernate3.0不支持与thread绑定,3.1以上才支持。   

 3. sessionFactory.getCurrentSession()方法取得的session,在做数据库操作时必须在事务中做,包

括只读的查询,否则会报错。


整合ssh事务问题

标签:ssh   事务   

原文地址:http://8092668.blog.51cto.com/8082668/1599108

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!