-->
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.  [ 7 posts ] 
Author Message
 Post subject: Hibernate + two databases
PostPosted: Mon Nov 15, 2004 5:49 pm 
Newbie

Joined: Sun Nov 07, 2004 7:03 am
Posts: 8
I want my application to work under 2 databases: main remote db and local backup db. Do I have to implement it on my own or hibernate implements such mechanism (f.i. synchronizing dbs' content)?
thnx in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 5:50 pm 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
you will need two separate HibernateManagers for each database with a different configuration file for each database.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 5:57 pm 
Newbie

Joined: Sun Nov 07, 2004 7:03 am
Posts: 8
I already have. The problem is it needs synchronization. Remote db would be used by many instances of the application, each of which has its own local db. Therefore, any operation on dbs needs copying from remote db to local db thos resources, which are not updated/created on local db. Particulary I found it hard to copy collections. So, are there any already created classes for that? I don't want to reinvent the wheel...
Thnx for response.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 6:51 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 8:40 pm
Posts: 30
Location: SF Bay Area
I haven't tried this ... but it should work ...

Add an additional session-factory to your hibernate.cfg.xml file.

No extra files needed.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 6:55 pm 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
mwiezik wrote:
I already have. The problem is it needs synchronization. Remote db would be used by many instances of the application, each of which has its own local db. Therefore, any operation on dbs needs copying from remote db to local db thos resources, which are not updated/created on local db. Particulary I found it hard to copy collections. So, are there any already created classes for that? I don't want to reinvent the wheel...
Thnx for response.


i have never tried to accomplish transaction management across different databases using hibernate. but i have done it using transaction management using Resin 3.x. does a pretty good job.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 7:38 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 8:40 pm
Posts: 30
Location: SF Bay Area
I don't see why, if you use a class like
HibernateUtil in the reference documentation to create
your connections, you should have any sychonization issues.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 15, 2004 10:32 pm 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
well, i guess i am not brave enough to take that chance in synchronizing between 2 databases. considering that i just had to undertake a project to do that, i should say that i am in a slightly better position to make that call because we had to take into account rollbacks etc across two separate sessions. additionally, the number of rows being synched was in the 1000s. so there were quite a few factors that went into that decision.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.