-->
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.  [ 2 posts ] 
Author Message
 Post subject: hibernate and db clustering
PostPosted: Mon Dec 06, 2004 11:38 pm 
Newbie

Joined: Mon Dec 06, 2004 10:57 pm
Posts: 1
hi,

I'm trying to understand how to build a nice DB foundation for a set of large sites, ie. spec a scalable setup on mysql + replication and hibernate

One solution 'pattern' that I was able to find on the net, is to have pairs of DB servers, each hosting part of the content base. For instance you could have users A to E on cluster 1, F to J on cluster 2, etc...

Each part of the content is served by 2 machines, mainly for redundancy but also for the extra query power.

Now, for example, I'd need to have a map saying, ok this user is in this jdbc pool... (I suppose I would have to provide a mapping for each field I want to select by (ie userID->pool, userName->pool))

That's where the problem is: how to I tell hibernate to use such and such db pool to load/update each particular object ?

Does hibernate have support for this kind of thing ?
Each entity would live only one one DB (in fact, two, but replicated out of hibernate's view), so maybe it's not a completely heretic thought, but still it would probably get in the way of bulk updates / selects ? (need two queries on two different connections to update two different users)

I'm reading the (nice) hibernate book and I don't remember anything about this - also I don't really know what to search for (ie. I call that DB clustering but I doubt it's the 'real' name)

Well thank you very much for reading me and I hope somebody will be kind enough to inform me :p

Stefan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 3:21 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
In Hibernate there's a one to one relation between a SessionFactory and a JDBC DataSource. All the nice ORM features are available within the scope of one SessionFactory only. (i.e. relations accros SessionFactoryies are not handled by Hibernate).

If you want to use Hibernate in your scenario you have to make it transparent. I didn't think about it in detail, maybe the follwing thoughts may give you a start:
  • Have different SessionFactories and deal with this fact in a DAO layer in order you busniess logic dosn't know about it.
  • Consider using an J2EE AppServer or something like http://c-jdbc.objectweb.org/ in order to make your clustering completely transparent to Hibernate.


HTH
Ernst


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