When hibernate is used for the first time, no currentsessioncontext configured
Solution:
1. For web applications, add
in hibernate.cfg.xml
<property name="current_session_context_class">jta</property>
2. For Java applications, add
in hibernate.cfg.xml
<property name="current_session_context_class">thread</property>