Rhyme/Hibernate getCurrentSession()與openSession()的區別

Hibernate getCurrentSession()與openSession()的區別 sessionFactory.getCurrentSession()會查看當前上下文環境中有沒有session,沒有則創建,,在這個session沒有提交之前,獲得的session永遠是同一個session,session一旦提交,則會獲取新的session,另外使用getCurrentSession()
相關文章
相關標籤/搜索