-->
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: Multiple DB providers and DB selection
PostPosted: Wed Aug 19, 2009 1:19 pm 
Newbie

Joined: Tue Jun 30, 2009 10:13 am
Posts: 6
Good afternoon,

I have an application with a login page that allows you to select the DB you wish to connect to via a drop-down list.

What is the best way to accomplish this without imposing a fair amount of overhead for the other db providers that are not actually used during the lifecycle of the application (one and only one of the DB is ever actually used since it can only be selected at login)

Thanks in advance.

Whatty


Top
 Profile  
 
 Post subject: Re: Multiple DB providers and DB selection
PostPosted: Wed Aug 19, 2009 9:57 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
I guess you could have a separate SessionFactory for each. Then only the database chosen ever has the SessionFactory for that db instantiated?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Multiple DB providers and DB selection
PostPosted: Fri Aug 21, 2009 10:12 am 
Newbie

Joined: Tue Jun 30, 2009 10:13 am
Posts: 6
I know this may seem like a very basic question and I apologize in advance, but I am fairly new to Hibernate and I haven't had much luck in finding out exactly how to do what you are proposing.

I am using Hibernate with Spring (also new to that) and I am not 100% sure how to control the instantiation of the SessionFactory, or do I instantiate both and dynamically select the session factory in my DAO object.

I am digging through the Spring documentation at the moment to dynamically parse a config file based upon the initial selection but thought I would ask anyway.

Thanks in advance.

Whatty


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.