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
  • 28,342
  • 21
  • 95
  • 123
Bhavik Ambani
  • 6,357
  • 14
  • 52
  • 84

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
  • 228,184
  • 37
  • 489
  • 472