-->
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: Multiple DataSources with Hibernate
PostPosted: Tue Mar 02, 2004 10:04 am 
Newbie

Joined: Wed Sep 17, 2003 5:15 am
Posts: 9
I wonder , if i can use more than one datasource with Hibernate simulteniously.

I'll explain:
we have two dirrenet tablespaces : for Users and for Products.

We want to use common object model. So the question is: can Hibernate support 2 datasources and keep track data integrity?

If yes, how can i configure it for it?
If no, would be such support included in next versions of Hibernate?

We are using Hibernate 2.1.

Thank a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2004 10:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can use two SessionFactorys with different datasources. You can not have object relationships across different databases, and there are no plans to support it. You can however use different schemas for different classes (if you use mysql you can use that feature to do use mutliple databases (on the same server)).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2004 1:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Hibernate, itself, does not have support for this.

You might want to look at something like C-JDBC for support of this. I am currently in planning phase of an app for which I am going to try this out; I've been watching that project pretty closely for a while and have been wanting to try it out. This app needs to read data from both a SQLServer and an Oracle datasource. C-JDBC is supposed to handle this for you seemlessly.

Just a thought...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2004 1:15 pm 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
Just an option-
If you are using oracle, you could create a dblink to the tables so hibernate sees them as 1 database.

--James


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 04, 2004 5:55 am 
Newbie

Joined: Wed Sep 17, 2003 5:15 am
Posts: 9
>steve
it's interesting idea, i took a look at C-JDBC - and it seems quite good for our needs.

Now i'm interesting do you have any expirience using it with Hibernate? does it really supports data integrity betweem tables that are in different datasources?

Some troubles/hints with using C-JDBC? perfomance?

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 04, 2004 2:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Nope not yet. To date I've been lucky enough that all the multi-db stuff has all been Oracle, so I just use DBLINKS / SYNONYMS between the different Oracle databases.

But I have a requirement for an app that I've prototyped using an Oracle database, but in actuality will need to "federate" data from an Oracle db and a SQLServer db. So give me two or three weeks and I'll have some experiences and stories, I'm sure :)


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.