org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
2012-12-16 23:08
375 查看
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation
of non-transactional one here
错误重现:public class BaseDaoImpl<T,PK extends Serializable> extends HibernateDaoSupport implements IBaseDao<T,PK>{
private Session getCurrentSession() {
return this.getHibernateTemplate().getSessionFactory().getCurrentSession();
}
public Serializable save(T o) {
return this.getCurrentSession().save(o);
}
}
调用save时 报错。
解决方案:
return this.getCurrentSession().save(o); 改成
return this.getHibernateTemplate().save(o);
相关文章推荐
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration
- 继承类的@Transactional:org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow crea
- 继承类的@Transactional:org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transac
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not a
- org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not
- 解决No Hibernate Session bound to thread, and configuration does not allow creat。。。
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- 解决No Hibernate Session bound to thread, and configuration does not allow create tansactional的问题
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
- No Hibernate Session bound to thread, and configuration does not allow creat
- No Hibernate Session bound to thread, and configuration does not allow creation
- No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- SmartGwt: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- No Hibernate Session bound to thread, and configuration does not allow create解决方案