You can use this method to access an object that implements Hibernate's Session interface, which is the primary interface through which applications can use Hibernate.
A session is a single-threaded context provided by Hibernate; your application will likely use it to issue queries; begin, commit, and roll back transactions; save and update objects; and the like.
getCurrentSession() retrieves whatever session is available to the current thread. If you are using the Spring integration with Hibernate, or if you have specified "current_session_context_class" as "thread" in your Hibernate configuration, you will probably use this method in your DAOs to access the Hibernate session.
|