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 Can we have 2 hibernate.cfg.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Can we have 2 hibernate.cfg.xml?" Watch "Can we have 2 hibernate.cfg.xml?" New topic

Can we have 2 hibernate.cfg.xml?

Tapan Maru
Ranch Hand

Joined: May 08, 2006
Posts: 65
Hi All,

Can we have 2 hibernate.cfg.xml files in class path? If yes, how hibernate will pickup the one? or will it pickup both the files?

Thanks in Advance...

Tapan Maru
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
What are you trying to achieve? What's wrong with using a single file?
Sunny Bhandari
Ranch Hand

Joined: Dec 06, 2010
Posts: 448

yes you can have multiple config files (as with struts)

in case of collision, the later mapping will override the first one...

Java Experience
I agree. Here's the link:
subject: Can we have 2 hibernate.cfg.xml?
It's not a secret anymore!