I don't understand the difference between those two mtehods in the way that it is described in documentation.
As I know both method create Session object.
I suspect from what I have read that:
"getCurrentSession()" is only allowed in container calls during JTA transaction (?) and "openSession()" is valid outside JTA transaction and container (in utility class) (?)
Is that true?
openSession() is actually creating a new session every time it is called.
getCurrentSession() returns a session associated with the current context, that may or may not be a jta transaction. It may be a new one or the one previously used in the same context.
At least thats how i understand the documentation.
Please correct my English.
Joined: Feb 05, 2012
Thanks, it seems reasonable.
subject: Hiberante - differnce between methods from SessionFactory - openSession() and getCurrentSession()