Hibernate OpenSession and getCurrentSession:
If you set
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:
Post a Comment