-->
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: database that depends on the user
PostPosted: Fri Aug 06, 2004 1:05 pm 
Newbie

Joined: Fri Aug 06, 2004 1:01 pm
Posts: 13
is it possible to work on hibernate with different databases ?
Depending on the user, I would work on database1 or database2.
If it's possible, how can I do that.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 06, 2004 1:08 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
Yes this is very possible. What is your environment? Are you using JBoss or just standalone Hibernate?

You will need to have seperate configurations (xml or properties files) for each database that you will be using. For each of these configurations you will generate a SessionFactory that could be stored into a Map with some key. When your user executes a request for information from the database, you simply can just do a look-up in the map to get the appropriate SessionFactory. This is a perfect fit for the command pattern....we do a very similar thing on my projects and it works great.

-Matt

_________________
Matt Veitas


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.