hibernate中 getCurrentSession的用法

1. 要使用 getCurrentSession()  方法,需要添加对应的配置

<property name="hibernate.current_session_context_class">thread</property> 

2. 注意:

  •  使用getCurrentSession 方法必须配合配置才能使用
  •  使用getCurrentSession获得session对象,在事物提交时自动关闭
原文地址:https://www.cnblogs.com/beibidewomen/p/7238609.html