• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate.properties vs. hibernate.cfg.xml

 
Andy Hahn
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any advantage to using one type of configuration over the other?
I am using Tomcat and it is complaining about a missing log4j anda missing hibernate.cfg.xml. However I have hibernate.properties in the classpath (I think...).

I am taking this whole setup one step at a time.

Thanks!
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hibernate.properties is an old way of representing the connection information. They replaced it with the XML-based configuration on the newer versions (from 2.0 onwards, I guess).

The XML version is more flexible and has more features.

If you have a .properties and a .xml file in your jar, then the properties in .xml will be preferred by Hibernate over those in the .properties file.

Hope this helps.
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andy Hahn:
I am using Tomcat and it is complaining about a missing log4j anda missing hibernate.cfg.xml. However I have hibernate.properties in the classpath (I think...).



For this, you need to have a log4j.properties file in your classpath. A simple solution would be to put a log4j.properties file under your 'src' directory. You can get a simple example from the log4j website.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic