-->
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.  [ 5 posts ] 
Author Message
 Post subject: Working with several databases.
PostPosted: Fri Jun 04, 2004 5:14 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
Hi, I want know if it is possible with Hibernate to connect to several Databases hosted in different servers.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 5:50 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 10:32 pm
Posts: 35
Location: Toronto, Ontario
Yes


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 05, 2004 2:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Not from the same session factory. You would need to use a seperate session factory for each underlying database.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 12:31 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
[quote]Not from the same session factory. You would need to use a seperate session factory for each underlying database.[/quote]
Ok. But what is the configuration of the hibernate.properties file considering the two databases hosted in different servers?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 9:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
If I understand your question correctly, you need two seperate Configurations. A Configuration is responsible for generating a SessionFactory. So basically you would just construct two different Configurations (each describing the connection characteristic and class mapped to each of the underlying databases) and then ask each to build a seperate SessionFactory.

You would need to explicitly specify the config file for at least one of these Configurations. Your best bet would be to use a common hibernate.properties for the common config attributes and then to have xml config files for each of the Configuration objects you need to construct.


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