-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Can I use both hibernate.properties and hibernate.cfg.xml?
PostPosted: Thu May 13, 2004 12:29 pm 
Newbie

Joined: Sat Apr 03, 2004 6:36 pm
Posts: 5
Hi,

I want to know whether we can use both hibernate.properties and hibernate.cfg.xml. I have one datasource details in configuration file and other in properties file. Will this work?

Thanks for your help..

Umar


Top
 Profile  
 
 Post subject: Can I use both hibernate.properties and hibernate.cfg.xml?
PostPosted: Thu May 13, 2004 2:38 pm 
Newbie

Joined: Sat Apr 03, 2004 6:36 pm
Posts: 5
Hi,

Can any one help me on this?...

UMAR


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 13, 2004 2:40 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Yes, cfg.xml overrides properties.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Can I use both hibernate.properties and hibernate.cfg.xml
PostPosted: Thu May 13, 2004 2:42 pm 
Newbie

Joined: Sat Apr 03, 2004 6:36 pm
Posts: 5
Thanks chris,

That means I need to have both the data base connection details in cfg.xml file. Am I correct?

Umar


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 13, 2004 2:51 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You can have them wherever you like.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 13, 2004 2:56 pm 
Newbie

Joined: Sat Apr 03, 2004 6:36 pm
Posts: 5
Hi Chris,

I think I am bit confused. My original question was whether I can use both hibernate.properties(which connect to one database) and hibernate.cfg.xml file(which connect to another database) in my application at once. I know that we can have more than one database connection details in cfg file.

My requirement is that I already have one cfg file in my application. I want to integrate my application with one more module written by others who is using hibernate.properties for connectiong to their database.

Thanks for spending some time for me. I am sorry for not explaining the problem in detail..

Umar


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 13, 2004 2:58 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It's quite simple: If you have a properties file and a cfg.xml file, Hibernate will read both, if there is a duplicate setting, the cfg.xml has precedence.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.