Hi modeling friends:
I want the Logical to Physical conversion process to construct new PK names by prepending subtype table names to the inherited PK fields.
I have a logical model that implements (part of) the Party/Role pattern (see http://tdan.com/a-universal-person-and-organization-data-model/5014 for example).
Party is identified by PartyID.
I have two specialized Parties - Offerer and Receiver - using an inheritance model that when converted using the “N Tables - Physical Model Matches Logical model” I get this:
OFFERER: PartyID (PFK), PartyType (= “OffererType” - FK to PartyType)
RECEIVER: PartyID (PFK), PartyType (=“ReceiverType” - FK to PartyType)
Now when The Offerer makes an offering and the Receiver chooses that offering, I store this in a Fulfillment table:
FULFILLMENT: PartyID* (Offerer), PartyID* (Receiver),
- Note the same attribute names - this is undesirable in the Physical Model.
When I convert the Logical model to a Physical model I want the inherited PKs to become like this:
OFFERER: OffererPartyID (PFK), TypeCode (= “Offerer” - FK from table PartyType)
RECEIVER: ReceiverPartyID (PFK), TypeCode (=“Receiver” - FK from table PartyType)
FULFILLMENT: OffererPartyID (PFK), ReceiverPartyID (PFK), DateTime (PK)
PARTYTYPE: TypeCode (PK)
Are there any defaults I can modify to make the subtype Primary Keys generate automatically using the subtype table name - eg “OffererPartyID” , and have that name then inherited by the dependent table (Fulfillment)?
Also, I want the Discriminator (ie “TypeCode” in my Logical model) to default to the subtype Table name (eg “Offerer”) - can I do that automatically when converting from Logical to Physical?