1. 要使用 getCurrentSession() 方法,需要添加对应的配置
<property name="hibernate.current_session_context_class">thread
</property>
2. 注意:
使用getCurrentSession 方法必须配合配置才能使用
使用getCurrentSession获得session对象,在事物提交时自动关闭
转载于:https://www.cnblogs.com/beibidewomen/p/7238609.html
相关资源:数据结构—成绩单生成器