Did you try mapping to a view that selects from the other database?
i.e. in DB1 you:

create view EntityFromDB2 as select blablabla from db2..entity

and you map nhibernate to EntityFromDB2


On Sep 5, 7:42 am, Gauthier Segay <[email protected]> wrote:
> I'm using ActiveRecord with multiple databases in single application
> with great success,
>
> Until now, I always had clear boundary context for theses separations
> but I'm looking for a mapping level solution (if available) to this
> need:
>
> I'm talking about 2 readonly databases (where I exposed bare SQL
> views), I would like to have a BelongsTo relation from an entity
> defined in DB1 to another entity defined in DB2.
>
> I'm not sure that NHibernate has ways to handle this, I just tried for
> the heck of it as a first spike to solve my need and I'm getting the
> following exception:
>
> MappingException: An association from the table {tablenamefromdb1}
> refers to an unmapped class: {TypeFromDB2BelongingToEntityFromDB1}
>
> I've tried to swap mapping configuration order to make db2 registered
> before db1 but the error is the same.
>
> I'm wondering if some ActiveRecordStarter.ModelCreated magic could
> overcome this exception.
>
> I'll understand if such thing is not possible, so I'm leaning to
> migrate this concern on my applicative service layer, so I would also
> like to gather experiences from other users in perspectives of
> possible solutions / experiences.
>
> Thanks for your insight
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to