-->
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: Working with more than one physical database
PostPosted: Thu Feb 08, 2007 7:28 am 
Newbie

Joined: Thu Feb 08, 2007 7:12 am
Posts: 3
Hi,

what is the standard practice when working with two or more databases? I am reading the documentation but working with more than one database is more of a footnote than a center topic in the hibernate referance.

My question is how do you deal "cleanly" with multiple databases, I am very satisfied with the DAO approach found here
http://www.hibernate.org/328.html are there any examples for multiple databases?

The problem is this there will be some entities in our HRM database and some entities in the Finance database but the application need to use both of this resources, does that mean I will have to have seperate HibernateUtils? Seperate DAOFactories? There will be then 2 distinct sessions(one for HRM Database and one for Finance)?

the getCurrentSession() of the HRM SessionFactory will not interfiere with getCurrentSession() of the Finance SessionFactory?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 08, 2007 8:13 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:20 am
Posts: 74
You would certainly need 2 sessions, and thus 2 config files.

You'd likely also have to do some magic of your own to map records in one database to records in the other (if needed) as there'd be no database entity storing those relationships.


Top
 Profile  
 
 Post subject: Re: Working with more than one physical database
PostPosted: Wed May 30, 2012 8:10 am 
Newbie

Joined: Wed May 30, 2012 7:57 am
Posts: 1
I am new to hibernate and Spring. I have worked with multiple databases using two hibernate.cfg.xml and writing two separate methods to get the session factory object for the different database. Is it the wright way? Or is there any better way of doing this? If you'll need to do different joins between these two databases then I would go for a more permanent solution.

_________________
Financial troubles are not rare, nevertheless there is an online lending service that may help.


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.