兩種Session方式 openSession和getCurrentSession

Hibernate有兩種方式獲得session,分別是:  openSession和getCurrentSession  他們的區別在於  1. 獲取的是否是同一個session對象  openSession每次都會得到一個新的Session對象  getCurrentSession在同一個線程中,每次都是獲取相同的Session對象,但是在不同的線程中獲取的是不同的Session對象  因爲是不
相關文章
相關標籤/搜索