Spring管理hibernate Session
代码Git地址:https://github.com/mingchunliu2083/practiceproject/tree/springhibernate
注意:
1,如果在程序中像这样使用:
sessionFactory.getCurrentSession().save(T);
如果不开启事务,则会报告
No Session found for current thread
错误。
2,spring4+hibernate4,使用hibernate的api的时候需要配置事务的,如果不配置事务会导致获取当前session抛出异常
posted on 2017-08-02 09:30 worldpeace7 阅读(245) 评论(0) 编辑 收藏 举报