• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

hibernate.properties vs. hibernate.cfg.xml

 
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!
 
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.
 
Everybody! Do the Funky Monkey! Like this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic