Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

separating the configuration files

 
manish ahuja
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic