2

The ideal place for Hibernate configuration files (.hbm.xml) is

.../tomcat/webapps/projectName/WEB-INF/classes/hbm

But I want to place those configurations settings in a different location, say

/usr/local/properties/hibernate

How can I do that?

If I place that configuration files in that location and if I start Tomcat then it gives me an error on loading that configurations saying

hibernate.cfg.xml not found

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bhavik Ambani
  • 6,557
  • 14
  • 55
  • 86

1 Answers1

3

To configure location of .cfg.xml file use Configuration.configure(File) instead of Configuration.configure() when creating SessionFactory.

To configure location of .hbm.xml files use Configuration.addDirectory().

See also:

axtavt
  • 239,438
  • 41
  • 511
  • 482