-->
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.  [ 3 posts ] 
Author Message
 Post subject: Use datasource pool across multiple databases
PostPosted: Wed Jan 23, 2008 12:57 pm 
Newbie

Joined: Fri Apr 13, 2007 12:25 pm
Posts: 17
Hey there-

I have an application with multiple instances of the same schema, one per corporate account. I would ideally like to pool datasources and be able to switch between schema depending on the caller's environment. Is this possible through hibernate? Right now I am maintaining a Map of SessionFactory objects for each schema, but at a certain point I'm going to max out of database connections if each factory maintains its own pool. I may also max out of memory storing the session factories in a map rather quickly as well. Any thoughts? I know using a mysql connection i can access the other databases' data by using schemaname.table type of notation, so theoretically this would be possible using JDBC.

Thanks for any input you could provide


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 23, 2008 2:57 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
If the schemas are located in the same database, you can have multiple mapping files per class, each one naming the entity differently and having a different "default schema" attribute.
In this way you still get only one sessionFactory and pooling, pointing to multiple schemas.

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject: Use datasource pool across multiple databases
PostPosted: Sat May 03, 2008 6:57 am 
Newbie

Joined: Tue Apr 29, 2008 9:15 am
Posts: 4
gonzao_diaz wrote:
If the schemas are located in the same database, you can have multiple mapping files per class, each one naming the entity differently and having a different "default schema" attribute.
In this way you still get only one sessionFactory and pooling, pointing to multiple schemas.



Could you please give some more details. How this can be used in while doing a query or save.


Thanks & Regards

unni


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