Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate.cfg.xml and hibernate.properties files in Hibernate

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
There are two configuration files in Hibernate by which we can configure the DB connection .One is xml configuration file (name Hibernate.cfg.xml) and other one is properties file (name hibernate.properties) .
Which configuration file should use ? Which one is the better approach ?

Thanks and regards,
Satya
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An alternative approach to configuration is to specify a full configuration in a file named hibernate.cfg.xml. This file can be used as a replacement for the hibernate.properties file or, if both are present, to override properties.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even hibernate documentation recommends to keep both types of file in your class path.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Subramani for the reply .
As per my understanding the properties file is the better approach , because its more user friendly and it support some default values as well.
Please correct me if am wrong .....


regards,
Satya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic