0

i have this

SessionFactory sessionFactory = new AnnotationConfiguration()
        .configure("com/vaannila/service/hibernate.cfg.xml")
        .buildSessionFactory();

          Session session = sessionFactory.getCurrentSession();

i get this error

org.hibernate.HibernateException: No CurrentSessionContext configured!
    org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)

2 Answers 2

2

You must set your hibernate.current_session_context_class in your hibernate.xml file.

Refer to the following: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-j2ee-currentsession

Sign up to request clarification or add additional context in comments.

Comments

2

have this entry in your cfg file.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.