-->
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: Hibernate and Master/Slave replicated databases
PostPosted: Tue Feb 08, 2005 1:56 pm 
Newbie

Joined: Tue Feb 08, 2005 1:39 pm
Posts: 2
Hello,

What sort of support does Hibernate have for dealing with a replicated database architecture where writes must be performed on the master while reads can take place on any slave? My company is developing a web application that is supposed to have mutliple instances of the application connected to a replicated database (most likely postgres w/slony) and I'm not clear on what the standard approach with Hibernate would be.

Is this just a matter of the application keeping two separate SessionFactory for reads ands writes, or can this be dealt with by clustering somehow?

Alternatively, is it simpler to use something like C-JDBC?

Thank you for any advice.

J.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 4:00 pm 
Senior
Senior

Joined: Tue Jan 11, 2005 5:03 pm
Posts: 137
Location: Montreal, Quebec
Hi,

My first guess would be to use 2 ConnectionFactories, 2 cfg file, one for each database.

You first load all Hibernate Pojo from the first cfg file (behind or not of a "finder" business layer encapsulating the database choice) and you use a "writer busines layer" implementing the "save" and "saveAndUpdate" actions on each Hibernate Pojos to load the same Pojo from the second data base (2nd cfg) to update its values.

Etienne
Montreal


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 6:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is a problem much better solved at the JDBC level.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 11:17 am 
Newbie

Joined: Tue Feb 08, 2005 1:39 pm
Posts: 2
Gavin,

Thanks for your response.

gavin wrote:
This is a problem much better solved at the JDBC level.


That is the direction I'm leaning in. I'm not entirely comfortable with trying to use Sessions from two different Factories - while I think it would work most of the time the edge cases seem overly problematic.

I may just recommend that we use a replicated databse, but only as a hot backup. It's rapidly becoming clear that there is a good reason that master-master replication is a feature available mostly in commercial products - its not an easy problem to solve.

One last thing, do you have any warnings agaisnt using C-JDBC in conjunction with Hibernate? As far as I can tell a setup like this should work fine.

Thanks again.

J.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 11:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No, in fact I'd really like to hear about people who've had sucess combining Hibernate with C-JDBC because we have some big customers who are very interested in this kind of thing.


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.