Skip to main content

Modeling relationships

To model relationships between elements, the LinkFieldType provides multiple types. These types will define the multiplicity and technical implementation.

There are 6 link fieldFieldA property of a DataElement expanded to a database column and user interface input element. types.

A short summary:

TypeMultiplicityManaged byNeeds reverse linkAcross components
Ln01many-to-onecodenoyes
Ln02many-to-oneJPAnono
Ln03many-to-many, owning sideJPAnono
Ln04one-to-manyJPAyes (Ln02)no
Ln05one-to-manycodeyes (Ln01)yes
Ln06many-to-many, other sideJPAyes (Ln03)no

LinkFieldTypes​

Many to one

  • Ln01: many-to-one, code-managed
  • Ln02: many-to-one, JPA-managed

One to many

  • Ln04: one-to-many, JPA-managed
  • Ln05: one-to-many, code-managed

Many to many

  • Ln03: many-to-many, JPA-managed, owning side
  • Ln06: many-to-many, JPA-managed, other side

A one-to-many link is the reverse of a many-to-one link in the other direction. There are some requirements to get this to work:

  • The links should both be either code-managed (Ln01 and Ln05) or JPA-managed (Ln02 and Ln04).
  • The many-to-one side (Ln01 or Ln02), should be named after the target data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept. (with first letter lowercase).
  • The data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept. on the many side should also have a Finder defined, called findBy{element}Eq, where {element} is the fieldFieldA property of a DataElement expanded to a database column and user interface input element. on the one side. See also Naming conventions.

Ln04 and Ln05 links need a reverse link to work.

The reverse link of an Ln03 (many-to-many) link is an Ln06 link on the other data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept.. In this case, the name of the Ln03 fieldFieldA property of a DataElement expanded to a database column and user interface input element. needs to be identical to the name of the element where the corresponding Ln06 link is specified, followed by the character "s".

There is currently no support for one-to-one links. Ln01 or Ln02 can be used on one side instead.

There are two technical implementations of a link fieldFieldA property of a DataElement expanded to a database column and user interface input element.. The selected type will impact how you use relations in the business logic implementation.

  • Relations within a component (JPA-managed): JPA-managed links are generated as references to JPA objects. The resolving is provided by the JPA implementation. JPA-managed links only work within components, since other components can have different schemas or databases.

  • Relations between components (Code-managed): Code-managed links will be generated as Long values in the data layerLayerLogical separation of functionality within a single system/application, focused on code organization.. The generated code will then resolve the links through lookups. Code-managed links work for links between components, since they do not require the tables to be in the same database or schema.