Skip to Content
avatar image
Former Member

Referential Integrity in HANA XS CDS.


Been trying to understand how to enforce data integrity at DB level with CDS. I have made a lot of study and I understand as a design principle CDS does not have foreign key constraints.

Then is the data integrity maintained at application level?

From other posts and study there is a lot of feedback that not having referential integrity would ultimately result in chaos at some point. The only advantage is that DB operations are faster.

Doesn't this cause an overhead in the application layer.

With HANA bringing everything into the DB layer, isnt this against the HANA philosophy?

Adding constraints after creating CDS seems like rework and doesn't come under delivery units too. For applications which has a complicated DB, with lots of references and relations, It's better to use SQL rather than CDS?

Correct me if I am wrong and please explain :)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 01, 2016 at 01:19 PM

    CDS is designed this way on purpose. The associations are not enforced by database constraints but should be checks/used in the Application Layer. For instance the associations are enforced by the XSDS/sap-cds library. They will also planned to be enforced by the new CDS based OData framework which is being developed in XS Advanced.

    Add comment
    10|10000 characters needed characters exceeded