openSession()和getCureentSession()的区别

时间:2023-03-10 01:33:07
openSession()和getCureentSession()的区别

openSession():永远是打开一个新的session

getCureentSession():如果当前环境有session,则取得原来已经存在的session,如果没有,则创建一个新的session

session commit后,原来的session就消失了。