File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Where to put *.hbm.xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Where to put *.hbm.xml file" Watch "Where to put *.hbm.xml file" New topic

Where to put *.hbm.xml file

ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208

I am new to Hibernate , and i want to ask that where to put *.hbm.xml file.

Please tell the necessary work for that.

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Put in the classpath in the same place as your pojo class.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Usually you will have your hibernate.cfg.xml in the root of your class path, then have your individual mappings in the same directory as your mapped objects.

Then in you hibernate.cfg.xml can point to the mapping files in a relative path that would actually match you package structure.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Where to put *.hbm.xml file
It's not a secret anymore!