Forums Register Login

org.hibernate.HibernateException: No CurrentSessionContext configured!

+Pie Number of slices to send: Send
I am getting the below error



Where ever I search in google they are giving the following answer


The above line is already added in my config file I am pasting the config file and the code where I am getting the error below
hibernate.cfg.xml


Main Class


Error Stack


Step 1
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Step 2Exception in thread "main"
Sesssion Factory value org.hibernate.impl.SessionFactoryImpl@104c575
org.hibernate.HibernateException: No CurrentSessionContext configured!
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:685)

 
+Pie Number of slices to send: Send
My issue got resolved the change I have done is as follows

Session session = sessionFactory.getCurrentSession(); //Earlier I was using

Session session = sessionFactory.openSession(); //I changed the above line to this as shown

Now it is working fine.
What's brown and sticky? ... a stick. Or a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 20306 times.
Similar Threads
Hibernate+GWT problem related to slf4j
Hibernate Setup - Beginner Questions
Java Security Exception
problem connection hibernate eclipse oracle10g
No TransactionManagerLookup specified Exception
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:44:42.