-->
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.  [ 1 post ] 
Author Message
 Post subject: multi database access
PostPosted: Sat Mar 06, 2010 9:13 am 
Newbie

Joined: Wed May 06, 2009 4:38 pm
Posts: 12
Hi,

I am designing a "multi tenant" web application which uses Hibernate to access to a high number of MySQL databases (or catalog : managed by a single database server) (> 500 identical databases for a single web application). I plan to use a single data source, in order to avoid saturating the db server with connections and to switch database according to the connected user tenant id.

I have been searching a good solution to do so for a few days, and I would like to ask 2 questions :

1) I have seen it is possible to switch database overriding the onPrepareStatement() method of EmptyInterceptor (like described here http://java.dzone.com/articles/hibernate-dynamic-table-routin). Do you think it is a good solution. Is there any better choice ?

2) I need to insure primary key uniqueness across databases for read-write entities, to avoid entity collisions in Hibernate. I think using a counter table in a shared database. But it may create a bottleneck for insert operations. How do you think I should implement this ?

Best regards,
Eric


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.