views:

4044

answers:

2

I keep getting a :

HibernateException: No CurrentSessionContext configured!

in my code. The only information other searches that returned is that the culprit is:

<property name="current_session_context_class">thread</property>

in my hibernate.cfg.xml. I do have that in my hibernate.cfg.xml file, and I am running this in Tomcat 6. Does anyone know other possible causes?

+1  A: 

I believe you need to set your current_session_context_class to an actual class...I have my hibernate.cfg.xml configured for that as follows:

<property name="hibernate.current_session_context_class">org.hibnerate.context.ThreadLocalSessionContext</property>

The above code is used for a mySql database but i don't think it matters what type the database is for the above property

Hope this helps

tkeE2036
A: 

In @atkeE2036's answer, "hibernate" is misspelled. Here's the correct spelling:

<property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
GeorgeCalm