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

Last modified: April 18, 2024

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):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<Order id="101">
	<number>1</number>
	<date>9/30/2008</date>
	<Order_Customer>id_201</Order_Customer>
</Order>

<Customer id="201">
	<fullname>Apple Inc.</fullname>
	<address>1 Infinite Loop</address>
	<telephonenumber>1-800-MY-APPLE</telephonenumber>
</Customer>

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):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<Customer id="201">
	<fullname>Apple Inc.</name>
	<address>1 Infinite Loop</address>
	<telephonenumber>1-800-MY-APPLE</telephonenumber>
	<Customer_Group>id_301 id_302</Customer_Group>
</Customer>

<Group id="301">
	<name>Multinational corporations</name>
</Group>

<Group id="302">
	<name>Hardware suppliers</name>
</Group>

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):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<Profile id="401">
	<religion>Buddhism</religion>
	<job>Chief Executive Officer</job>
	<website>http://www.apple.com/ </website>
	<Customer_Profile>id_201</Customer_Profile>
</Profile>

<Customer id="201">
	<fullname>Steve Jobs</fullname>
	<address>1 Infinite Loop</address>
	<telephonenumber>1-800-MY-APPLE</telephonenumber>
	<Customer_Profile>id_401</Customer_Profile>
</Customer>

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):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<Accountant id="501">
	<idnumber>1</idnumber>
	<name>Earl Grey</name>
	<telephonenumber>1-800-EARL-GREY</telephonenumber>
	<Accountant_Group>id_301 id_302</Accountant_Group>
</Accountant>

<Accountant id="502">
	<idnumber>2</idnumber>
	<name>Scrooge McDuck</name>
	<telephonenumber>1-800-SCROOGE-MCDUCK</telephonenumber>
	<Accountant_Group>id_301 id_302</Accountant_Group>
</Accountant>

<Group id="301">
	<name>Multinational corporations</name>
	<Accountant_Group>id_501 id_502</Accountant_Group>
</Group>

<Group id="302">
	<name>Hardware suppliers</name>
	<Accountant_Group>id_501 id_502</Accountant_Group>
</Group>

8 Read More