Mendix 7 is no longer supported unless you have Extended Support (for details, please contact Mendix Support). Mendix 7 documentation will remain available for customers with Extended Support until July, 2024.
Associations
1 Introduction
The Associations tab is a tab in the entity properties and has the following settings:
For more information on associations, see Association and Their Properties.
2 Name
The name of the association is used to refer to it from forms, microflows, XPath constraints, etcetera.
3 Type
This property defines whether an association is a reference (single) or a reference set (plural).
Value | Description |
---|---|
Reference | Single: an object of the owning entity refers to zero or one objects of the other entity. |
Reference set | Plural: an object of the owning entity refers to zero or more objects of the other entity. |
- Default value: Reference
4 Owner
This property defines whether an association has one or two owners. If there is one owner, the owner is located at the start of the arrow.
Value | Description |
---|---|
Default | Only one entity is the owner (the parent). |
Both | Both entities are owners. |
- Default value: Default
5 Type and Owner Relation to Multiplicity and Navigability
Type and Owner properties of an entity are related to Multiplicity and Navigability properties of an association. When you change Type or Owner, you change Multiplicity and Navigability as well.
You can find correspondence between Type/Owner and Multiplicity/Navigability in the table below.
Type | Owner | |
---|---|---|
Multiplicity: one-to-one Navigability: not available |
Reference | Both |
Multiplicity: one-to-many Navigability: not available |
Reference | Default |
Multiplicity: many-to-many Navigability: X objects refer to Y objects |
Reference set | Default |
Multiplicity: many-to-many Navigability: X and Y objects refer to each other |
Reference set | Both |
For more information on multiplicity and navigability, see section 2.3 Multiplicity and section 2.4 Navigability in Associations and Their Properties.
6 Parent/Child
Parent and child settings show you the direction of the association. Parent defines an entity the association starts from, and child defines an entity the association ends with.
7 Association Examples
Drawing an association from the Order entity to the Customer entity results in the following:
The type property has its default value Reference
. In this example, a customer can have multiple orders, and an order can only have one customer.
In XML, instances of these entities and their association look as follows (note that the association is only stored in the Order element):
|
|
A many-to-many association with default ownership is created by drawing an association and then setting the Type
property to Reference set
.
In this example, a Customer can have multiple Groups, and a Group can have multiple Customers:
In XML, instances of these entities and their associations look as follows (note that the association is only stored in the Customer element):
|
|
A one-to-one association is created by setting the owner property to Both
(while leaving the type property at its default value Reference
).
In this example, a Customer can have one Profile, and a Profile can have one Customer:
In XML, instances of these entities and their associations look as follows (note that the association is stored both in the Profile element and the Customer element):
|
|
A many-to-many association where both entities are owners is created by setting the owner property to Both
and the type property to Reference set
.
In this example, an Accountant can have multiple Groups and a Group can have multiple Accountants:
In XML, instances of these entities and their association look as follows (note that the association is stored both in the Accountant element and the Group element):
|
|