0

Encountered the error below when I downgraded my Hibernate version from 5.0 to 4.3.11.Final. I've tried to google it but couldn't find anything.

The type org.hibernate.jpa.HibernateEntityManagerFactory cannot be resolved. It is indirectly referenced from required .class files

   private synchronized SessionFactory initSessionFactory() {

      if (sessionFactory == null) {
         Configuration configuration = new Configuration();
         configuration.configure();

         serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();

         sessionFactory = configuration.buildSessionFactory(serviceRegistry);
      }

      return sessionFactory;
   }

   public Session getSession() {

      if (session == null) {

         session = initSessionFactory().openSession();

      } else {

         session = initSessionFactory().getCurrentSession();

      }

      return session;
   }

Update

Fixed the issue by running the commands below

mvn eclipse:clean to clear .project .classpath .settings in the folder
mvn clean install to clear target and build the project will also download jars if you deleted .m2 (like in my case)
mvn eclipse:eclipse so i can update/import project in eclipse
dimas
  • 2,487
  • 6
  • 40
  • 66
  • Hibernate jar is not there in classpath, http://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-class-files – Vasu Nov 06 '16 at 19:27
  • it is there unfortunately, however fixed the issue by restarting eclipse – dimas Nov 07 '16 at 16:50

0 Answers0