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.  [ 5 posts ] 
Author Message
 Post subject: Multiple Databases, on different Servers - NHibernate 2.0.1
PostPosted: Thu Oct 30, 2008 7:33 am 
Newbie

Joined: Thu Oct 30, 2008 7:10 am
Posts: 3
Hibernate version: NHibernate 2.0.1.GA
Name and version of the database you are using: SQL Server 2005
Application Type: Asp.Net 3.5, N-Tier

Hi,

What is the best way to configure multiple databases (on different servers.). Everything I've read seems to be on 1.2. Has there been any changes in 2.0 or is this: http://www.codeproject.com/KB/aspnet/NH ... leDBs.aspx
still the best way to do it?

I've also read on NHibernate.Burrow but don't know if it's useable for 3.5.

Any pointers would be appreciated...

Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2008 12:50 pm 
Newbie

Joined: Thu Oct 30, 2008 7:10 am
Posts: 3
Update:
http://www.codeproject.com/KB/aspnet/NH ... leDBs.aspx seems to work quite well with the latest NHibernate.

I can't seem to get what I want to work tho...

I want to have <bag>s that go across database, but I (rightly) get this error: "An association from the table TableAToTableB refers to an unmapped class"

The bag is:
Code:
<bag name="TableBs" lazy="true" cascade="save-update" table="TableAToTableB">
      <key column="TableAId" />
      <many-to-many class="TableB" column="TableBId" />
</bag>


Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2009 5:37 am 
Newbie

Joined: Fri Jan 16, 2009 5:21 am
Posts: 1
Hi. Did you manage to solve the problem. I am in a similar situation and need assistance. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2009 9:26 am 
Newbie

Joined: Thu Oct 30, 2008 7:10 am
Posts: 3
Nope, ran out of time in my investigations so abandoned my POC. Would be interested to know if you get anywhere tho.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2009 1:56 pm 
Newbie

Joined: Mon Feb 16, 2009 1:26 pm
Posts: 1
Location: Argentina
Been reading for two weeks about this issue.
So far, I can sum up as this:

* If your entities belong to different databases, you can not define any one-to-one, many-to-one, nor one-to-many relationship at all.

There are several posts that show you how to deal with this issue, when the n-databases are, actually, n-catalogues within same database.
Another strategy I read about, relies on database linking (if at least, supported by one of the DBMS to "every" other you need to use).
In these two scenarios, you will be dealing with only one sessionFactory.

Again, so far, I couldn't find any post anywhere, showing how to work with entities from different SessionFactory(ies). I assume you have to do the wiring on your own: after you get your A entities (using hibernate), cycle through them, then get (using hibernate) & manually "link" your B entities to the A(es).

Regarding "relationship" persistance, when cascading option applies, you will have to handle it on your own. A and B entities, each can be updated in their own container session. The relationship will be saved in a regular property(ies if composite).

Hope to see anybody telling this is not right and posting a solution to this issue. Good luck.

PS: links related:
http://forum.hibernate.org/viewtopic.ph ... +databases
http://forum.hibernate.org/viewtopic.ph ... base+mysql
http://forum.hibernate.org/viewtopic.ph ... +databases
http://forum.hibernate.org/viewtopic.ph ... +databases

PS2: Check whether Shards is an option. Perhaps there is a "place" for Shards. Not sure how it works, but conceptually you may create one shard pointing to a dummy table and the second shard pointing to the real table in 2nd DB. Not very sure about this, since it is supposed to be horizontal partition, whether you will be able or not to hit diff DBs.

_________________
Tomás Casas
SE, MSCMT


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