• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is the default location of hibernate.cfg.xml

 
Ranch Hand
Posts: 237
MyEclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am getting error,hibernate.cfg.xml not found
whille using return new Configuration().configure().buildSessionFactory();

what is the first location that hibernate will look for hibernate.cfg.xml.

thanks
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It needs to be on the classpath in the default package (i.e. in the folder all your classes are).
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question gets asked alot in here. Do a quick forum search and you'll find lots of people in the same shoes as you.

If you have folder such as \source that all your classes and packages are in, you typically put the hibernate-config.xml file in there. But remember, at runtime, it needs to be moved to your runtime classpath. Build tools usually compile and move Java code to a \build or \bin or \classes directory. Sometimes the config file doesn't get moved as well. So, make sure that config file is on the RUNTIME classpath, not just your build time classpath.

Here's a little tutorial I put together on setting up a Hibernate environment:

Getting Started with Hibernate - Configuring a Standard XP Environment

Good luck! If this doesn't help, tell us more about your environment.

-Cameron McKenzie
 
They gave me pumpkin ice cream. It was not pumpkin pie ice cream. Wiping my tongue on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic