Currently in my project I have all the hibernate artifacts placed together under one package.i.e all the Hibernate generate java objects, cfg.xml file as well as hbm.xml files. Now for a specific requirement I have to move the cfg.xml to a separate project. So now I have to specify the path of these files in my HibernateUtil class where in I have all the configuration related code. Since these cfg xml's have been moved to a separate project they will now be available as a bundle inside a jar at runtime when the application is deployed. I am trying to include the project(which consists the cfg xml files) in my current project (which has all the hibernate code) but somehow I am not able to correctly refer the path of the cfg xml.
Joined: Aug 21, 2008
You can drop the cfg.xml file at the root of the other jar, and when this jar is in the classpath of you project, the config file would be picked up by Hibernate automatically, since it is a reaource found at the root of the classpath, and hibernate uses it by default. Have you tried this?