Hi guys,
I am new to Hibernate and have done a search on this but have found loads of other (useful) tips and advice but not for what I need.
Basically I was wondering if it's possible to specify another location for the hibernate.cfg.xml file rather than the main class path of the project.
The reason is, when I compile up my code and export it as a jar file, I have the hib xml file in there - with all the settings for the specifc environment I'm working on (i.e., UAT or SIT or DEV or PRD). I really hate having to manually alter the hib xml for a specific region and re-exporting the compiled code. I'd much rather have the hib xml file external in a common /config dir and edit it externally.
But all my attempts at trying to manually specify the hib xml file in a place of my choice fail with the exceptions complaining it cannot find the hib xml file.
At the moment I am using the following which works fine - but I have to keep my hib xml file in the default project path:
Code:
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Is what I want possible? If so, does someone have a working example of code they could post?
Or if I am reiterating a dead topic could someone please point me in the right thread direction?
Many thanks and apologies if this is an old subject.