I need to create a session factory for hibernate, but by default it looks for "hibernate.cfg.xml" file. I did not create this file. All hibernate config is in "applicationContext.xml" file of Spring MVC config. All I need to do is provide "/WEB-INF/applicationContext" file path to the "configure" method of Configuration class, but I don't know how find the relative path to this file in JAVA.
public static SessionFactory createSessionFactory() {
Configuration configuration = new Configuration();
configuration.configure(HERE I NEED TO GET "/WEB-INF/applicationContext.xml FILE PATH");
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory; }