This question is in relation to another question I have asked, but what are the reasons as to why you would use openSession() over getCurrentSession()? I know you would use openSession() so that you could self-manage the closing and flushing of the session, however, why would you want to do this manually?
I have used openSession() when I wanted to perform a transaction in isolation to the current session though I am not sure if this is a correct use of openSession().
Why would you want multiple sessions open?
One would use
openSession()to implement long conversations (i.e. when you want to use use a single Session for several database transactions aka the extended Session pattern).Hmm… What? Transaction and Session are different concepts. What do you mean exactly?
That’s not the intention.
References