If I have objects that represent a hierarchy of relationships. For example:

    Spouse Contact
    Spouse Address
  Person Contact
  Person Address

Each of the items listed has a database table related to an object. Each object/table has an ID, Parent ID (Spouse ID for Spouse Address records) and Base ID (Person in the example). Given that hierarchies can be arbitrarily deep and wide, how would you design the objects and data access layer?

  • isn't spouse a person too? – Mithir Apr 23 '13 at 5:16
  • yay its a contrived example from something I was staring at, its more of just the hierarchal relationship. – cldfzn Apr 23 '13 at 5:32
  • 1
    @Mithir Not always. Some are beasts too – BЈовић Apr 23 '13 at 6:25
  • Why not have a RelatedPeople table and a Relationships table? So the RelatedPeople table would match up two people and say what the relationship is. – Amy Blankenship May 2 '13 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.