單例模式的SessionFactory與getCurrentSession()的使用

 getCurrentSession()獲得的session的好處。  (1)currentSession和當前線程綁定。  (2)currentSession在事務提交後自動關閉 1.hibernate.cfg.xml 中添加的配置 <property name="hibernate.current_session_context_class">thread</property> 2.dem
相關文章
相關標籤/搜索