Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added limitations for compositions of one #729

Merged
merged 9 commits into from
Mar 12, 2024
6 changes: 6 additions & 0 deletions cds/cdl.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,12 @@ entity Orders.Items {
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
Using of compositions of one 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 compostions of one are involved. You must fill in foreign keys manually in a custom handler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this depends very much on wether we are talking about a composition of one entity or a composition of one aspect.

The may in difference is that for a composition of one entity the foreign key is on the parent side where as for a composition of one entity the foreign key is on the target side. This makes compositions of one aspect more friendly wrt. modifications over paths.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a runtime expert, but my assumption is that the restrictions mentioned here only apply to "composition of one entity" - correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback Adrian @agoerler, I've added the word entity to make limitations more clear.
Steffen @stewsk, you are right, I'm writing about entities here.

:::

### Managed Compositions of Aspects {#managed-compositions}

Use managed compositions variant to nicely reflect document structures in your domain models, without the need for separate entities, reverse associations, and unmanaged `on` conditions.
Expand Down
Loading