The hibernate.cfg.xml file is the configuration file for hibernate and as such it is vital for the use of hibernate. Like any other configuration file, you need to make it available within the classpath for the code to be able to use it.
This can be accomplished in different ways, depending on your project.
- For a web-app WAR project (you are running the program in a Servlet container): placing it in
WEB-INF/classeswill work as files in
WEB-INF/classesare visible on the classpath when app is running in container.
- For a Maven-style project (not running the program in a Servlet container): placing it in
- For otherwise, try in the