NHibernate mapping of one class containing 2 references to the same entity?

Up vote 1 down vote favorite share g+ share fb share tw.

I have a person class, then have a family class where I have a property Father and a property Mother of type Person. I have a database table for Person and a Family table containing FamilyId, FatherId, MotherId where FatherId and MotherId is foreign keys for PersonId in Person table. How would you go about to map this in NHibernate?

Nhibernate nhibernate-mapping link|improve this question asked Mar 2 '10 at 20:52adriaanp983517 77% accept rate.

This mapping expresses your tables. Public class Family { public virtual int Id { get; set; } public virtual Person Mother { get; set; } public virtual Person Father { get; set; } }.

Maybe you have good reasons for your dehtml.

Martin thanks for great info, will look into it – adriaanp Mar 3 '10 at 19:44.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions