The hibernate documentation says:
A org.hibernate.Session begins when the first call to getCurrentSession() is made for the current thread. It is then bound by Hibernate to the current thread. When the transaction ends, either through commit or rollback, Hibernate automatically unbinds the org.hibernate.Session from the thread and closes it for you. If you call getCurrentSession() again, you get a new org.hibernate.Session and can start a new unit of work.
If the property current_session_context_class
is set to thread
then what exactly hibernate does? What does it mean when they say current thread?
This post says SessionFactory.getCurrentSession() returns a session bound to a context
, what it means exactly, can someone please clarify?