Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.hibernate.HibernateException: No CurrentSessionContext configured!

 
VenkataPrasad Regula
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
VenkataPrasad Regula
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic