I use STS and i've created MVC template project. I want to use hibernate but i don't know where to put hibernate.cfg.xml. In default projects i just put it in src/ folder.
static {
try {
// Create the SessionFactory from hibernate.cfg.xml
//AnnotationConfiguration
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
I know that i can strictly add path to Hibernate.cfg.xml like that:
sessionFactory = new Configuration().configure("XXX").buildSessionFactory();
where XXX is the path to hibernate.cfg.xml. Where should i put hibernate.cfg.xml if i will use "/hibernate.cfg.xml" like path? Thanks!