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