Or perhaps use <join> if it is reasonable that tables A and B end up in the
same class.

/Oskar


2009/4/26 Thomas Koch <[email protected]>

>
> Hi Gustavo - thank you for your reply.  :-)
>
> I have investigated the one-to-one mapping tag, but from what I can
> understand the parent class "A" would have to slave its id property to
> its child class "B" and I do not want that.
>
> Reading this link I got an idea:
>
> http://sdesmedt.wordpress.com/2006/07/24/nhibernate-part-3-mapping-techniques-for-aggregation-one-to-one-mapping/
>
> In it Serge suggests mapping this relationship as one-to-many
> association where the "B" entity is reduced to a component. Currently
> that seems to be the most promising path. Either that or I'll have to
> convince the rest of the team to add a propery "Id" column to the "B"
> table.
>
> Thomas
>
>
>
> On 25 Apr., 23:07, Gustavo Ringel <[email protected]> wrote:
> > I never used one-to-one relations, but it seems to be a case for this
> right?
> >
> > Gustavo.
> >
> > On Sat, Apr 25, 2009 at 11:49 PM, Thomas Koch <[email protected]> wrote:
> >
> > > Hi - I have a "funny" association between two tables in a legacy
> > > database we are moving to NHibernate:
> >
> > > A
> > > Id:int
> > > ...
> >
> > > B:
> > > AId:int
> > > ...
> >
> > > What it says is that the primary key of B is both primary key of B and
> > > a foreign key to A, thus sharing the same values as A.
> > > B is not required thus I guess you would call it a 0-1.
> >
> > > I cannot get my head around mapping this. If only B had an extra Id
> > > column for the primary key, it would be easy enough.
> >
> > > Any suggestions?
> >
> > > Regards
> > > Thomas Koch
> >
>

--~--~---------~--~----~------------~-------~--~----~
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