Sunday, August 12, 2018

Hibernate OpenSession and getCurrentSession:
 If you set hibernate.current_session_context_class to thread  then you can access that session anywhere else by using the SessionFactory.getCurrentSession().
SessionFactory.openSession() always opens a new session that you have to close once you are done with the operations. SessionFactory.getCurrentSession() returns a session bound to a context - you don't need to close this.

No comments: