File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes separating the configuration files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "separating the configuration files " Watch "separating the configuration files " New topic
Author

separating the configuration files

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All,

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.

Please advice.

Thanks
Raf Szczypiorski
Ranch Hand

Joined: Aug 21, 2008
Posts: 383
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: separating the configuration files