In Service Studio, an entity encloses not only the logical definition of a business entity, but also its relationships with other entities.

Create a relationship

In Service Studio, relationships are created by defining a reference attribute (aka foreign keys, in database terminology). Its data type is the <Entity> Identifier. This data type corresponds to the type of the Identifier of the other entity.

In OutSystems Platform it is not possible to have a composite foreign key, i.e. you can only have a foreign key with one attribute.

Static entities can only have relationships with other static entities. Learn more about static entities.

When the reference attribute is defined, an index is automatically created in order to improve the performance of your eSpace. This index is called:

AutoIndex_<reference attribute name>

and covers the reference attribute that implements the relationship.

You should not delete this index; if you do, Service Studio displays a warning notifying you of the performance impact this operation might have.

The entity where this reference attribute should be created depends on the cardinality (One-to-One, One-to-Many, Many-to-Many) and optionality (mandatory or optional) of the relationship.

The relationships you specify between your entities are visible in the entity definition since the reference attribute has a different icon and it is also visible in the Entity Diagram, depending on the type of the relationship.

Types of relationships

A relationship can be:

Referential integrity

When you create relationships between an entity A and an entity B, you must specify the referential integrity mechanism that you want to apply in your eSpace. That is: what must happens in entity B if the corresponding record in entity A is deleted. How?

See Also

Entity Description | Entity Attributes | Delete Rules | Database Constraints