-->
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.  [ 6 posts ] 
Author Message
 Post subject: Working with 2 databases
PostPosted: Fri Mar 26, 2004 10:47 am 
Newbie

Joined: Thu Jan 15, 2004 5:04 am
Posts: 6
I have to work with 2 databases.
How can I do it with Hibernate?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 26, 2004 12:42 pm 
Beginner
Beginner

Joined: Wed Mar 17, 2004 7:59 am
Posts: 24
Create a DAO factory for each of your databases, each one will use it's own hibernate.properties file and have it's own session factory.

Then use the appropriate DAO factory to execute the queires, get objects etc...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 26, 2004 3:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
As towny said, use 2 SessionFactoy with different parameters : use hibernate.cfg.xml type configuration, not hibernate.properties for that

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 05, 2004 4:20 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
how should I set the session factoy parametres as different conf files?

I did:
Configuration conf = new Configuration();
Properties prop = new Properties();
prop.load(new FileInputStream(" ../...../hibernate.myDB1.cfg.xml"));
conf.setProperties(prop);
.... = conf.configure().buildSessionFactory();

but it doesnt work, what am I missing?

_________________
-developer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 05, 2004 9:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://www.hibernate.org/hib_docs/api/net/sf/hibernate/cfg/Configuration.html#configure(org.w3c.dom.Document)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 06, 2004 2:58 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
very much thanks Emmanuel

_________________
-developer


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