Subtype and supertype

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 31-May-2012 23:09:42   

Hi, i have two entities: Incident and Action

Action is subtype of Incident. Incident has the following fields: IncidentId (PK), Time, Description Action has the following fields: IncidentId (PK), ActionDetails

An incident has been submitted and now i want to create an action for it. How can i do it?

Creating a new instance of Action will obviously not work. I can always get the Incident using the incident id and then create a new action and set its Time and Description fields from the fetched Incident entity and delete the fetched Incident entity but i am thinking there is gotta be an easier way.

Any pointers?

thank you

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 01-Jun-2012 07:46:14   

In short: This is not possible. If this is a real case scenario maybe those entities shouldn't be on inheritance. A 1:1 related entity approach would be more appropriate.

If you want to create an Action, then create it, this will automatically create an Incident row in your db. My recommendation is: destroy the inheritance hierarchy. If you want to stick with this setup, you will have to hack it. Some options:

a) map the Action table to an entity "again" and now call the entity "ActionSingle" or something like that. This ActionSingle entity is not part of the inheritance so you can use it to create single rows in the Action table.

..or

b) delete the old incident and now create an action.

David Elizondo | LLBLGen Support Team