0

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?

Community
  • 1
  • 1
learner
  • 6,062
  • 14
  • 79
  • 139
  • possible duplicate of [Hibernate openSession() vs getCurrentSession()](http://stackoverflow.com/questions/8046662/hibernate-opensession-vs-getcurrentsession) – Sudhansu Choudhary Aug 17 '15 at 17:49
  • @SudhansuChoudhary, the link explains clearly about openSession, but the information for getCurrentSession is not clear, what it means current thread, what exactly hibernate does in this scenario, can you please explain – learner Aug 17 '15 at 17:52

0 Answers0