--- title: "Entity join" slug: "core-entity-join" updated: 2026-05-19T12:34:19Z published: 2026-05-19T12:34:19Z canonical: "docs.lobstersoftware.com/core-entity-join" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Entity join ![images/download/attachments/167859497/image-2024-1-22_18-8-47-version-1-modificationdate-1705943327256-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-8-47-version-1-modificationdate-1705943327256-api-v2.png) An [Entity join](/v1/docs/en/core-entity-join) uses the **On** condition to include assigned instances of the *entity type* selected as the **Entity** in a search under the name specified as the **Join alias**. In contrast to all other [Joins](/v1/docs/en/core-abstract-join), the [Entity join](/v1/docs/en/core-entity-join) is based exclusively on the condition *explicitly* formulated in the **Join alias**. Other relationships between entities in the search and the joined instances are neither expected nor taken into account. The relationship to the *entity type* selected as the **Entity** can therefore be defined completely arbitrarily via the **On** condition. --- **IMPORTANT:** The access restrictions that may apply to the main entity of a search due to ownership, participation and [Company authorizations](/v1/docs/en/base-company-release) categorically do not apply to access to instances of the *entity type* selected as the **Entity**. --- ## Configuration | Parameter | Data type | Description | | --- | --- | --- | | ***Specific parameter*** | | **Entity** | *Entity type* | *Any* entity type can be selected as the **Entity**. The [Combobox](/v1/docs/en/fre-combo-box-vo) also offers options that cannot be selected as a (main) "entity" for a search. Example: ![images/download/attachments/167859497/image-2024-1-22_12-6-26-version-1-modificationdate-1705921587052-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_12-6-26-version-1-modificationdate-1705921587052-api-v2.png) | | ***Generic parameters*** | | **Join alias** | `String` | A string that uniquely identifies the entity provided by the join as a prefix in the data field path must be specified as the **Join alias**. ![images/download/attachments/167859497/image-2024-1-22_18-9-19-version-1-modificationdate-1705943359894-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-9-19-version-1-modificationdate-1705943359894-api-v2.png) enables ![images/download/attachments/167859497/image-2024-1-22_18-11-56-version-1-modificationdate-1705943516212-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-11-56-version-1-modificationdate-1705943516212-api-v2.png) Characters that are not permitted for a **Join alias** (such as the space or period) are automatically replaced by an underscore: ![images/download/attachments/167859497/image-2024-1-22_13-9-43-version-1-modificationdate-1705925383386-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_13-9-43-version-1-modificationdate-1705925383386-api-v2.png) ... is replaced by ... ![images/download/attachments/167859497/image-2024-1-22_13-10-26-version-1-modificationdate-1705925426296-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_13-10-26-version-1-modificationdate-1705925426296-api-v2.png) | | **CAUTION****:** If the internal name of a data field is specified as the **Join alias**, the **Join alias** overrides this property name for the context of the search. As long as the data field in question is not accessed within the search, this is not critical and may therefore remain unnoticed until a corresponding access is attempted. | | **Join type** | *Enumeration value* | By *default*, the **Join type** "Left" (`LEFT`) is preset so that the [Entity join](/v1/docs/en/core-entity-join) has no restrictive effect on the search even if the **On** condition does not return any matches. The **Join type** "Inner" (`INNER`) can act as a restriction for the search if the **Optional** option is unchecked. Only results for which the [Entity join](/v1/docs/en/core-entity-join) has "contributed" at least one match based on the **On** condition will then appear in the search result. | | **Optional** | `Boolean` | The **Optional** option is checked by *default*. The relevant **Join** is then only transferred to the database query at runtime if projections require this. | | **NOTE:** As long as a join defined as **Optional** is not executed at runtime due to a lack of necessity, any errors in its configuration cannot be detected. This can give the misleading impression that a certain **On** condition only works in an *optional join*. In reality, however, the "optional" join may not take place at all on the database side. | | **On** condition | *Restriction* | The **On** condition optionally defines which criterion (see [Restrictions](/v1/docs/en/core-i-search-restriction)) must be fulfilled for a *join* to contribute data to the search result. Typically, the **On** condition relates data from entities that are "candidates" for an assignment from the perspective of the *join* to data from entities that may be the target of the assignment. [Projections](/v1/docs/en/core-i-search-projection) for "candidates" use the **Join alias** as a prefix. If no **On** condition is specified, the [Entity join](/v1/docs/en/core-entity-join) assigns *all* instances of the *entity type* selected by **Entity**. Depending on other parameters in the search, their number can multiply the number of search result rows. --- **NOTE:** In the language used for the **Join type** (`LEFT`, `INNER`, `RIGHT`), the "candidates" are always on the "right-hand side" of the relationship established by the join. The positioning within any [Field restriction](/v1/docs/en/core-property-search) used as a *check* *value* or *compare value* is irrelevant in this respect: ![images/download/attachments/167859497/image-2024-1-22_18-13-33-version-1-modificationdate-1705943613226-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-13-33-version-1-modificationdate-1705943613226-api-v2.png) is interchangable to ![images/download/attachments/167859497/image-2024-1-22_18-14-10-version-1-modificationdate-1705943650679-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-14-10-version-1-modificationdate-1705943650679-api-v2.png) | ## Examples ### Simple use case: Access to the owner account of a user Like every entity type, [Users](/v1/docs/en/base-user) also use a `Long` property "owner" (`ownerId`), which can be used to refer to the "ID" (`id`) property of a company that is considered the "owner" of a specific user. The data model of the entity (*here*: user) only contains the `Long` value of the reference, so that detailed data on the owner company must be included in a search via a join if required. Specifically, a CSV search should combine the "username" (`username`) and the "owner" (`ownerId`) properties from the user account with the "account number" (`address.accNumber`) address property of the owner company. Configuration: | The screenshot on the right shows the configuration for the [CSV search](/v1/docs/en/core-csv-search) with [Projections](/v1/docs/en/core-i-search-projection) and [Joins](/v1/docs/en/core-abstract-join): - The first [Property projection](/v1/docs/en/core-property-projection) directly accesses the "username" (`username`) property in the user account. - The second [Property projection](/v1/docs/en/core-property-projection) directly accesses the "owner" (`ownerId`) property in the user account. - The third [Property projection](/v1/docs/en/core-property-projection) refers to the "owner" company via **Join alias** `cmp` in order to return its "account number" (`address.accNumber`) address property. The assignment of the "owner" company for each user is regulated by the [Entity join](/v1/docs/en/core-entity-join): - The "Company account" (`CompanyAccount`) *entity type* is selected as the **Entity**. - The name `cmp` (as an abbreviation for "Company") was arbitrarily assigned as the **Join alias**. In less straightforward scenarios, a more meaningful alias name (e.g. `ownerCompany`) would certainly be recommended. - "Inner" is selected as the **Join type**, as our list should only contain users for whom the **On** condition is fulfilled. - The **Optional** option has been unchecked so that the "Inner" join also has a restrictive effect if none of the output columns explicitly refer to the `cmp` alias (see "Variant" below). - The **On** condition requires that the reference in the "owner" (`ownerId`) property must match the "ID" of a company (`cmp.id`) so that it is assigned to the user in the search result. | ![images/download/attachments/167859497/image-2024-1-22_18-6-56-version-1-modificationdate-1705943217094-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-6-56-version-1-modificationdate-1705943217094-api-v2.png) | | --- | --- | A special feature of this use case is that the *join* can only return exactly one or no results from the company accounts for each user, and not multiple results. There are two cases in which the *join* does not provide a company account: - The company account referenced as "owner" no longer exists because it has been deleted. - "No owner" is referenced for a user. In this case, the "owner" (`ownerId`) property is automatically assigned the value `-1`, which no company account can use. In both cases, no assignment is made, which in this case (in conjunction with the "Inner" **Join type**) means that the user in question does not appear in the results list. Variant: Instead of a CSV search, a "normal" [Search](/v1/docs/en/core-search) is carried out, which lists complete [Users](/v1/docs/en/base-user) instances to which an "owner" account has been successfully assigned. | In the [Search builder](/v1/docs/en/administration-system-search-builder), the "Search type" for the existing configuration can be changed from [CSV search](/v1/docs/en/core-csv-search) to [Search](/v1/docs/en/core-search). This eliminates the [Projections](/v1/docs/en/core-i-search-projection) and only the [Entity join](/v1/docs/en/core-entity-join) shown on the right remains: - As we have unchecked the **Optional** option, the "Inner" **Join type** has a restrictive effect on the search as a whole, even without the existence of a projection that refers to the `cmp` alias. Only user accounts that refer to a specific "owner" company appear in the results list. - If the **Optional** option is checked, the results list may also contain [Users](/v1/docs/en/base-user) who are not assigned an "owner" or who refer to a company account as "owner" that does not (or no longer) exist. In this case, the [Entity join](/v1/docs/en/core-entity-join) would no longer have any influence on the result, as it neither "feeds" [Projections](/v1/docs/en/core-i-search-projection) nor acts as a restriction. It is therefore not mapped in the database, even though it is included in the configuration. | ![images/download/attachments/167859497/image-2024-1-22_18-5-14-version-1-modificationdate-1705943115124-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-5-14-version-1-modificationdate-1705943115124-api-v2.png) | | --- | --- | ### Special use case: SELF JOIN to search for duplicates Many configurations such as [Association criteria](/v1/docs/en/core-association-criteria) or [Event handling](/v1/docs/en/administration-designer-workflow-action-event-handler-configuration)g have a "name" (`name`) property in which a text can be entered that should identify the configuration element in question with appropriate precision to enable quick identification (e.g. in an overview or a *dropdown*). It is not absolutely necessary for the assigned "name" within the respective *entity type* to be unique, as these configurations – like all entities – are identified by the system using their unique and automatically assigned "ID" (`id`). In order to maintain a certain degree of transparency, it can do no harm, for example, to search periodically or on an ad hoc basis for names that have been assigned more than once in the context of implementation. In the following example, a CSV search determines such "duplicates" for [Association criteria](/v1/docs/en/core-association-criteria). Configuration: | As a minimum, the CSV search should contain three [Projections](/v1/docs/en/core-i-search-projection) for output columns: - The first [Property projection](/v1/docs/en/core-property-projection) refers to the "name" (`name`) property, i.e. the key value for recognizing "duplicates". - The second [Property projection](/v1/docs/en/core-property-projection) specifies the "ID" (`id`) of the association criterion that is evaluated as the original in the result line. - The third [Property projection](/v1/docs/en/core-property-projection) should specify the *alternative* "ID" (`alias.id`) of an identified "duplicate" with the same name. The duplicate search is based here on an [Entity join](/v1/docs/en/core-entity-join) with the **Join alias** `alias`. - You could call the [Entity join](/v1/docs/en/core-entity-join) a "SELF JOIN", as it refers to the same *entity type* in the **Entity** parameter that the search itself addresses (*here*: association criterion). - The **Join type** "Inner" in conjunction with the unchecked **Optional** option ensures that only rows for which the `alias` contributes a value are output in the result. - The **On** condition (see below for details) is intended to ensure that the join assigns all *other* assignment criteria for which the same "name" (`name`) is specified to each association criterion. | ![images/download/attachments/167859497/image-2024-1-22_18-2-39-version-1-modificationdate-1705942959235-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-2-39-version-1-modificationdate-1705942959235-api-v2.png) | | --- | --- | | The screenshot on the right shows the **On** condition that maps the criterion for the assignment of duplicates as a [Search junction](/v1/docs/en/core-search-junction) with an AND junction from two instances of the [Field restriction](/v1/docs/en/core-property-search): - The first [Field restriction](/v1/docs/en/core-property-search) ensures that a comparison for the "ID" (`id` vs. `alias.id`) property does not result in a match (`!=`). Otherwise the SELF JOIN would identify each association criterion as a duplicate of itself. - The second [Field restriction](/v1/docs/en/core-property-search) ensures that the "Name" (`name` vs. `alias.name`) property matches. The `alias` data record should only be assigned to the parent data record if both conditions are met. --- **IMPORTANT:** If the search is carried out in a context in which access restrictions for reading (="searching") [Association criteria](/v1/docs/en/core-association-criteria) are applicable, it should be noted that these only affect the main level of the search (i.e. the "left" side of the join). The comparison is therefore not carried out according to the scheme "all association criteria" vs. "all (other) association criteria". Instead, it only checks whether there are any duplicates (`alias`) for all *readable* [Association criteria](/v1/docs/en/core-association-criteria) with regard to the name. As no access restrictions are taken into account for the `alias` side of the comparison ("right" in the join), the search may also show duplicates that relate to "unreadable" [Association criteria](/v1/docs/en/core-association-criteria). | ![images/download/attachments/167859497/image-2024-1-22_18-3-15-version-1-modificationdate-1705942995169-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-1-22_18-3-15-version-1-modificationdate-1705942995169-api-v2.png) |