Friday, December 27, 2013

org.hibernate.HibernateException: No CurrentSessionContext configured!

Exception in thread "main" org.hibernate.HibernateException: No CurrentSessionContext configured!  at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1010)
   at com.ranga.App.main(App.java:24)

Problem:  
We are missing current_session_context_class In the hibernate.cfg.xm file.

Solution: 
In hibernate.cfg.xml file add the following property.
<property name="current_session_context_class">thread</property>

0 comments: