| Author |
what is the default location of hibernate.cfg.xml
|
sudheer kiran
Ranch Hand
Joined: Jun 26, 2008
Posts: 237
|
|
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
|
Sudheer
SCWCD, SCJP 5
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
It needs to be on the classpath in the default package (i.e. in the folder all your classes are).
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Joined: Aug 26, 2006
Posts: 4967
|
|
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
|
Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
|
 |
 |
|
|
subject: what is the default location of hibernate.cfg.xml
|
|
|