-->
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: Slightly different multi-database question
PostPosted: Thu Mar 10, 2005 10:12 am 
Newbie

Joined: Tue Mar 08, 2005 11:29 am
Posts: 14
I know the multiple database question has been beat to death on the forums here but I do have an idea / question. We have a use-case on our Spring (1.1.5) + Hibernate (2.1.8) where we need to store the same information into multiple databases. Basically the domain mappings would be the same just the database they pointed to would need to change.

What would be the danger, if any, of getting a Session from a SessionFactory and using something like Session.reconnect to "switch out" the connection at runtime? That way we can get a default connection from the SessionFactory and use AOP as needed to switch out the connection.

Thanks,
C


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 1:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why not just use user provided connections ?
sf.openSession(yourConnection)

AOP is not something one should apply anywhere just because you can ,)

-max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 3:37 pm 
Newbie

Joined: Tue Mar 08, 2005 11:29 am
Posts: 14
Quote:
AOP is not something one should apply anywhere just because you can ,)

Here, here! I couldn't agree more. :)

I guess my answer to your question would be because we would have to 'manually' manage the Session in our DAOs. Since we've bit off on Spring's abstraction of the Hibernate API that would be a re-write of most, if not all, of our DAOs. I'm not aware of any way to tell Spring's HibernateDAOSupport or HibernateTemplate to use the SessionFactory.openSession(Connection) call. But, I'll be extremely happy if I'm wrong and someone can point me in the right direction. :)

Since all that really changes is the database target where the information gets stored it just seems easier (it may not be in reality) to work a way to use multiple data sources/connections to those databases.


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.