“`getCurrentSession 会绑定当前线程,而 openSession 则不会。 getCurrentSession 事务是 Spring 控制的,并且不需要手动关闭,而 openSession 需要我们自己手动开启和提交事务。 “` Was this helpful? YesNo 0 / 0 上一篇: hibernate 实体类必须要有无参构造函数吗?为什么? 下一篇: hibernate 对象有哪些状态? 发表回复 取消回复0 Your email address will not be published. 在此浏览器中保存我的显示名称、邮箱地址和网站地址,以便下次评论时使用。