Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

separating the configuration files

Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic