原文:No Hibernate Session bound to thread, and configuration does not allow

今天晚上挺悲催的,遇到了這個問題花費我很長時間,現在總結如下: 到這這種情況的發生有兩種情況: ,沒有配置事物只要在Spring配置文件中添加如下代碼: 然后在DAO程序前面加上 Transactional即可。 ,連接數據的配置是否正確,如果連接字符串不正確的話,就不能夠創建SessionFactory,也就無從談起事務了。 我的問題是第二種,我怎么能想到,我會粗心到數據庫連接字符串弄錯呢 ...

2012-03-28 22:39 2 21622 推薦指數:

查看詳情

HibernateException: No Hibernate Session bound to thread

解決No Hibernate Session bound to thread  背景交代   在使用this.getHibernateTemplate().getSessionFactory().getCurrentSession()方法獲取session時報以下異常信息 ...

Thu Feb 04 19:02:00 CST 2016 0 5299
Hibernate中解決No Hibernate Session bound to thread問題

引用:忘了 首先是getCurrentSession()與openSession()的區別: 1、getCurrentSession()與openSession()的區別?   * 采用getCurrentSession()創建的session會綁定到當前線程中,而采用 ...

Tue Mar 14 03:25:00 CST 2017 0 2884
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM