Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

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.
 
this is supposed to be a surprise, but it smells like a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!