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.  [ 3 posts ] 
Author Message
 Post subject: Multiple Config Files ?
PostPosted: Fri Mar 07, 2008 9:50 am 
Newbie

Joined: Tue Jan 22, 2008 9:53 am
Posts: 18
Hi guys,

I have a trivial problem, but i couldn´t find out a elegant solution for it.
I need to connect to a 2 different databases, each one with different configuration, drivers and anything else.
What is the best way to do this ?
I thought the best way was making two different hibernate.cfg.xml. One for each database and pass the file name as an argument when creating a session factory: new Configuration().configure("database1.cfg.xml");
But, for some reason, hibernate keeps looking for the file named hibernate.cfg.xml even if i pass the filename as argument in configure() method. What am i doing wrong ?

this is the error
org.hibernate.HibernateException: /hibernate.cfg.xml not found

Any ideas will be appreciated

thanks in advance


Top
 Profile  
 
 Post subject: Re: Multiple Config Files ?
PostPosted: Fri Mar 07, 2008 10:15 am 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Weird. I suggest you look at the stack trace and make sure the call is really the one you made. It is possible that you are making a default Configuration somewhere in your code. If not, set the hibernate log level to debug and show me the log.


Farzad-


Top
 Profile  
 
 Post subject: You´re right
PostPosted: Fri Mar 07, 2008 10:26 am 
Newbie

Joined: Tue Jan 22, 2008 9:53 am
Posts: 18
Hello Farzad,

Thank you very much for your help. I was really making a default configuration in another part of the code and could notice that changing the log level to debug.
It´s all working now.
Thanks for you help, time and patience.

Have a good day.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.