Heyaz,
I'm looking at a couple options for modeling entities in my data model. #1 Use sub-categories, #2 Entities standalone. There's a best practice of not mapping a non-PK attribute to more than one table... how does this apply in the following situation?
1 sub-categories...
Party (entity base)
... id
... type
... name
... Person (sub-category)
...... lastname
...... firstname
...... DOB
... Organization (sub-category)
....... name
Address (FK Party.id)
... id PK
... PersonId FK, AK1
... addressType FK, AK1
... addressLines
So, in #1 Address is mapped to Party and "inherited" by sub-categories. Not a problem as I understand it.
2 standalone entities...
Person
... id PK
... lastname
... firstname
... DOB
Organization
... id PK
... name
Address (FK Party.id)
... id PK
... EntityId FK (Person or Organization)
... addressType FK
... addressLines
In #2 both Person and Organization are FKs to Address. Address has a surrogate key. EntityId and addressType are AKs/constrained unique. This is a problem as I understand it.
Does this work? Must I make the PK real (as in EntityId+addresstype)?
Thoughts?
Best,
/jhd