原文:Hibernate openSession() 和 getCurrentSession的區別 .

Hibernate openSession 和 getCurrentSession的區別 getHiberanteTemplate getCurrentSession和OpenSession 采用getCurrentSession 創建的Session會綁定到當前的線程中去 而采用OpenSession 則不會。 采用getCurrentSession 創建的Session在commit或roll ...

2012-02-09 19:10 0 9557 推薦指數:

查看詳情

【譯文】【學習】Hibernate openSessiongetCurrentSession區別

【目標讀者】   本教程為那些需要理解Hibernate框架以及使用Hibernate框架應用的java程序員而設計。 【前置條件】   你需要先懂得java語言以及sql基本知識。 【教程目錄】 Introduction to hibernate framework ...

Tue Jan 03 23:32:00 CST 2017 1 2566
openSessiongetCurrentSession區別

1、openSession 每一次獲得的是一個全新的session對象,而getCurrentSession獲得的是與當前線程綁定的session對象 package cn.kiwifly.view; import org.hibernate.SessionFactory; import ...

Sun Dec 07 18:05:00 CST 2014 1 2590
Spring 4 + Hibernate 4 下 getCurrentSession()的使用情況

前言:1 getCurrentSession創建的session會和綁定到當前線程,而openSession不會。    2 getCurrentSession創建的線程會在事務回滾或事物提交后自動關閉,而openSession必須手動關閉    這里getCurrentSession本地 ...

Sat Nov 28 00:53:00 CST 2015 0 2610
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM