单例模式的SessionFactory与getCurrentSession()的使用

 getCurrentSession()获得的session的好处。  (1)currentSession和当前线程绑定。  (2)currentSession在事务提交后自动关闭 1.hibernate.cfg.xml 中添加的配置 <property name="hibernate.current_session_context_class">thread</property> 2.dem
相关文章
相关标签/搜索