How Model Inheritance Works
As mentioned above, several aspects of a model will get inherited from ancestor models. They are explained in detail below:
Levels and Fields
All fields from the first level of a model will get inherited by a child model, and exist within the first level of the child. Inherited fields are not removable, and only editable to a certain degree. The following properties are not editable:
Name
Type
any type-specific properties (for example, the enumeration type in a String Enumeration field)
The rest of the properties are editable:
Description
Key Field
Column Name
all other fields that are strictly DB-related
Child levels will also get inherited, for multi-level models. Below is an example of an inherited child level. As you can see, the level has:
Intrinsic fields: ChildLvlTwoNK, ChildLvlTwoField
Fields inherited from the corresponding level on the parent model: ChildLvlTwoNK, ChildLvlTwoField
Natural keys denormalized from parent levels: ChildNK, ParentNK, GrandparentNK
Every level needs its own natural key. Otherwise, you will not be able to create more than one record at the child level for each record at its parent level. In our example above, ChildLevelTwo MUST have a natural key (it can be defined intrinsically or on a parent model if that level is inherited). The studio does not allow to create a model without its own natural key.
Actions, Views, and State Machines
In the MPT, actions and views from ancestor models are inherited and displayed in italics, like fields in the Model Editor. They behave the same as views and actions inherited from the same model in another MPT (module); views' permissions can only be modified, and all aspects of actions can be overridden.
If an intrinsically-defined view or action shares the same name as an inherited view or action, the intrinsic one will override the inherited one and the inherited one will be crossed out in the list:
State Machines can be inherited just as they are from the same model in another module. When the override checkbox is checked, a drop-down appears with the option to select an inherited state machine or define your own:
In the SPT, nothing is inherited between custom models. Actions and views that are inherited within the MPT are brought down for their respective custom models, but there is no inheritance beyond that.
Java Classes and Database Tables
Model subtypes are easily implemented in Java using the extends keyword, so each Model's Java class holds its own intrinsic fields, and the developer can still access inherited fields via methods on the superclass.
Database tables, on the other hand, hold all fields for a model, both intrinsic and inherited.