-->
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: Changing datasource lookup dynamically
PostPosted: Fri Feb 25, 2005 1:35 am 
Newbie

Joined: Fri Feb 25, 2005 1:21 am
Posts: 1
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.6

Name and version of the database you are using:
Oracle 9i

Hi,
This is concerning a web application that is internationalized running on WAS 5.1.
We have a case where the database for specific locales are different.
We intend to pick up the jndi lookup name configured for each database dynamically depending on the locale of the user.

The jndi lookup name is now configured in the hibernate.cfg.xml
as <property name="connection.datasource">jdbc/A_JNDI</property>.

Is there a way to override the jndi lookup after hibernate configuration and after the sessionfactory is loaded?

Any help would be appreciated.

Thnx,
Sunil


Top
 Profile  
 
 Post subject: Re: Changing datasource lookup dynamically
PostPosted: Fri Feb 25, 2005 2:18 am 
Regular
Regular

Joined: Thu Dec 18, 2003 2:14 am
Posts: 103
Location: Brooklyn, NY
sunil_athreya wrote:
We intend to pick up the jndi lookup name configured for each database dynamically depending on the locale of the user.

Ai! You want to dynamically switch the database Hibernate is using based on user locales?! That is, to put it mildly, not scalable beyond 1 user.

A far better solution would be to run different app servers, each on those localized databases, and have Apache direct the user to the correct one based on locale. Or better yet, come up with a better solution for i18n than duplicating your database.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 25, 2005 3:29 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Quote:
Is there a way to override the jndi lookup after hibernate configuration and after the sessionfactory is loaded?

No. You can dynamically change the Configuration, but you have to recreate the session factory.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 25, 2005 5:59 am 
Newbie

Joined: Tue Feb 22, 2005 9:34 am
Posts: 4
I am not sure but does Configuration allows to change the database settings at runtime?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 25, 2005 8:09 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Quote:
I am not sure but does Configuration allows to change the database settings at runtime?


Yes it does. But as I've written in the previous post you have to recreate the session factory in order this is taken into effect.

HTH
Ernst


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.