What is the difference between
Code:
Session openedSession = HibernateManager.openNewSession();
and
Code:
sessionFactory.getCurrentSession();
method.
Is the latter one, would open a session, if there isn't an opened session.
I know that latter one also need a configuration line in hibernate.cfg.xml file. ( <property name="current_session_context_class">thread</property>) And if I didn't write this line hibernate give me an error. Do I really need this line in my hibernate.cfg.xml file and How can I handle session management in my HibernateManager code ?
I am not really sure for this issue and need experts advices.
Thank you
anut