Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate.cfg.xml vs. .properties file

 
Skip Cole
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a quick dumb questions.

When I initially set up hibernate I set it reading from a properties file.

I have variables like this:
protected static String username = "";

Which get read in a static block like this:
url = resourceBundle. getString("username");

And then finally used like this:
ac.setProperty ("hibernate.connection.username", username);

(Where ac is an Annotation Configuration.)

I guess part of the reason I did this (other than the fact that I end up doing things the hard way) is that I liked the idea of just telling whoever installs this application to "Edit all of the .properties files to fit your system." Instructing the install people edit .properties files AND xml files seemed like just another step that could get missed.

Any strong feelings on this?
Am I missing something that could (of will given my luck) bite me later on?

Thanks!
Skip
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put username in a hibernate.properties file, it will be loaded automatically.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic