From 644148ae301e90267c91b00dbdb294815cdf7586 Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Thu, 13 Nov 2025 11:43:21 +0000 Subject: [PATCH 1/4] add link to YT short on many-to-many link entity --- cds/cdl.md | 1 + 1 file changed, 1 insertion(+) diff --git a/cds/cdl.md b/cds/cdl.md index 278deb9b1..49e19551a 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -951,6 +951,7 @@ entity Emp2Addr { ``` [Learn more about **Managed Compositions for Many-to-many Relationships**.](#for-many-to-many-relationships){.learn-more} +[Watch a short video by DJ Adams to see an example of how a link entity can be used.](https://www.youtube.com/shorts/yGg3YD1weIA){.learn-more}
From a93b25851d69734c52b135b68ed2e5f5ff180e5d Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Thu, 13 Nov 2025 11:43:54 +0000 Subject: [PATCH 2/4] add punctuation to clarify syntax and rules apply because they're associations, not because a contained-in relationship is represented --- cds/cdl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cds/cdl.md b/cds/cdl.md index 49e19551a..895572a30 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -980,7 +980,7 @@ entity Orders.Items { ``` :::info Contained-in relationship -Essentially, Compositions are the same as _[associations](#associations)_, just with the additional information that this association represents a _contained-in_ relationship so the same syntax and rules apply in their base form. +Essentially, Compositions are the same as _[associations](#associations)_, just with the additional information that this association represents a _contained-in_ relationship; so the same syntax and rules apply in their base form. ::: ::: warning Limitations of Compositions of one From c83fdfe0f076ddf5f1e579b8c3410337216e06e7 Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Thu, 13 Nov 2025 11:49:56 +0000 Subject: [PATCH 3/4] add link to KISS best practice Emphasises the 'keep models simple' in the context of this warning about compositions-of-one. --- cds/cdl.md | 1 + 1 file changed, 1 insertion(+) diff --git a/cds/cdl.md b/cds/cdl.md index 895572a30..61e0153d9 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -987,6 +987,7 @@ Essentially, Compositions are the same as _[associations](#associations)_, just Using compositions of one for entities is discouraged. There is often no added value of using them as the information can be placed in the root entity. Compositions of one have limitations as follow: - Very limited Draft support. Fiori elements does not support compositions of one unless you take care of their creation in a custom handler. - No extensive support for modifications over paths if compositions of one are involved. You must fill in foreign keys manually in a custom handler. +See the [Keep it Simple, Stupid](/guides/domain-modeling#keep-it-simple-stupid) best practice, especially the [Prefer Flat Models](/guides/domain-modeling#prefer-flat-models) section. ::: ### Managed Compositions of Aspects {#managed-compositions} From 3d40504972aca22beb5f59935662d89a214f49ad Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Fri, 14 Nov 2025 07:58:23 +0000 Subject: [PATCH 4/4] be more precise on the default cardinality context Reading the "managed composition" part made me first think of the Orders:Items element when talking about the cardinality, but that's to-many, which had me wondering for a sec. But I think what's being referred to here is the backlink, i.e. this `up_` element: ```yaml Orders.Items: kind: entity includes: [OrderItems] elements: up_: key: true type: cds.Association cardinality: { min: 1, max: 1 } target: Orders keys: [{ ref: [ID] }] notNull: true ``` --- cds/cdl.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cds/cdl.md b/cds/cdl.md index 61e0153d9..4d8a2746a 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -1040,7 +1040,7 @@ aspect OrderItems { #### Default Target Cardinality -If not otherwise specified, a managed composition of an aspect has the default target cardinality *to-one*. +If not otherwise specified, a managed composition of an aspect has the default target cardinality *to-one* for the backlink. #### For Many-to-many Relationships