You're over-thinking your problem. Don't combine the two. They represent two
different things. Map each separately.

If you just want to share some logic, make an interface or abstract base
class that is common to your UserDetails and CompanyDetails, but NHibernate
should be ignorant of this.

On Mon, Mar 15, 2010 at 10:03 AM, [email protected] <[email protected]>wrote:

> Aloha!
>
> I have the following problem: I need to map multiple tables to single
> class (tables are not connected and represent completely different
> business entities).
>
> To be more specific, I have 2 different entities: User & Company. Each
> of them has "primary" info stored in corresponding tables (Users &
> Companies) + "dynamic" info stored in the linked Details Tables (like,
> UserDetailStringValues & CompanyDetailStringValues).
> Basically, there's no difference between UserDetailStringValues &
> CompanyDetailStringValues tables, except they have different foreign-
> keys.
>
> So, in order not to duplicate the code I've created single class
> called StringDetailValue.
> And it really works, but only using SPs (different data adapters call
> different SPs). But with NHibernate I can't write something like:
>   session.Load<DetailStringValue>(1);
> because it doesn’t know what exactly I want to retrieve from database
> (ie, User or Company detail).
>
> So, my question is: how can I specify the source from which I want to
> load data? Something like:
>   session.From(“UserDetailStringValues”).Load<DetailStringValue>(1);
> or
>
> session.From(“CompanyDetailStringValues”).Load<DetailStringValue>(1);
>
> Actually, I suspect that there's no (simple) way to solve my issue,
> but may be I missed something..? :)
> I would be really appreciated for a hint or link on some article.
>
> Thx & br,
> Vova
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to