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

UUIDs do not match with deep insert and composition #1070

Open
aschmidt93 opened this issue Mar 11, 2025 · 0 comments
Open

UUIDs do not match with deep insert and composition #1070

aschmidt93 opened this issue Mar 11, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@aschmidt93
Copy link
Contributor

Description of erroneous behaviour

When using a deep insert to create a parent entity (UUID as key) and its child via composition, the child will not have the generated UUID of the parent as its backlink but instead a random one.

I'm not sure whether this is a db layer or service layer problem. Here, @cap-js/postgres is used.

Detailed steps to reproduce

Service & entity:

using { cuid } from '@sap/cds/common';

service MyService {
    entity Parent : cuid {
        name : String;
        child : Composition of one Child;
    }

    entity Child {
        key parent : Association to one Parent;
        name : String;
    }
}

Request:

"POST /Parent"
{
  "name" : "foo",
  "child" : {
    "name" : "bar"
  }
}

Result:

    {
      "ID": "6202fa47-8105-4bb9-b002-a6208ae8c80b",
      "name": "foo",
      "child_parent_ID": "80a2f386-3fa5-47f4-82dc-1e2ae9a3a075",
    },

Details about your project

| @cap-js/asyncapi | 1.0.2 |
| @cap-js/cds-typer | 0.32.1 |
| @cap-js/cds-types | 0.9.0 |
| @cap-js/db-service | 1.17.2 |
| @cap-js/hana | 1.6.1 |
| @cap-js/openapi | 1.1.2 |
| @cap-js/postgres | 1.11.1 |
| @sap/cds | 8.7.1 |
| @sap/cds-compiler | 5.7.4 |
| @sap/cds-dk | 8.7.1 |
| @sap/cds-fiori | 1.3.0 |
| @sap/cds-foss | 5.0.1 |
| @sap/cds-mtxs | 2.5.1 |
| @sap/eslint-plugin-cds | 3.1.2 |
| Node.js | v20.15.0 |

@aschmidt93 aschmidt93 added the bug Something isn't working label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant