Domain Model (Metamodel)

Last update: Download PDF Edit


The domain model represents the data that is stored in your app. Each module has a domain model, consisting of entities, which have attributes of a certain type and associations with other entities.

Attributes have a value which can either be a StoredValue, which is a value stored in the database, or a CalculatedValue, which is computed from a Microflow.

The entities can also relate to each other through generalizations. Finally, you can define access rules, validation rules, event handlers and indexes for entities.

Graphical overview

Studio Pro Guide | Model SDK API docs -| Domain Model | TypeScript module domainmodels Entities | DomainModel Attributes | Entity Associations | Association | Attribute


Entities can have multiple attributes. Each attribute has a specific type.

Graphical overview - Non-numeric attributes

Graphical overview - Numeric attributes

Studio Pro Guide | Model SDK API docs -| Attributes | Property attributes of Entity | Attribute | AttributeType

Generalization relationships

Entities can have a Generalization relationship with another entity. The entity is then called a Specialization. A specialization entity inherits all attributes, validation rules and access rules from its Generalization entity.

An Entity instance has a generalization property with which to define this relationship. It can either be set to a NoGeneralization instance if it is not a specialization of another entity, or it can be set to a Generalization instance. A Generalization instance has again a generalization property which must point to the entity that is the actual generalization.

Graphical overview

Studio Pro Guide | Model SDK API docs -| Entities (section “Inheritance Properties”) | Property generalization of Entity | GeneralizationBase | Generalization | NoGeneralization

Access rules

To secure access to the data in a Mendix app, you can define access rules for entities. An access rule is always defined for a certain module role, defines to which attribute or association members that role has access, and the retrieved data is constrained by an xpath constraint.

Graphical overview

Studio Pro Guide | Model SDK API docs -| Access rules | Property accessRules of Entity | AccessRule | Property xpathConstraint of AccessRule | ModuleRole

Validation rules

For each attribute of an entity, it is possible to define a validation rule. The validation rule is applied to a single attribute, will show some error message, and it is a certain type of rule, e.g. the attribute needs to be equal to a certain value, or has a maximum length, or needs to be unique.

Graphical overview

Studio Pro Guide | Model SDK API docs -| Validation Rules | Property validationRules of Entity | ValidationRule | RuleInfo


An entity can have multiple indexes. Each index consists of a set of indexed attributes.

Graphical overview

Studio Pro Guide | Model SDK API docs -| Indexes | Property indexes of Entity | Index | IndexedAttribute