sessionFacroty.openSession()跟sessionFacroty.getCurrentSession()的区别

sessionFacroty.openSession()和sessionFacroty.getCurrentSession()的区别org.hibernate.AssertionFailur

sessionFacroty.openSession()和sessionFacroty.getCurrentSession()的区别

org.hibernate.AssertionFailure: null id in? entry (don't flush the Session after an exception occurs)

?

sessionFacroty.openSession()和sessionFacroty.getCurrentSession()的区别。

大致上前者需要关闭session,后者在commit之后session自动关闭。