Skip to content

(cds 9) No native HANA associations #1827

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions guides/databases-hana.md
Original file line number Diff line number Diff line change
Expand Up @@ -659,25 +659,26 @@ All limitations for the SAP HANA Cloud database can be found in the [SAP Help Po

### Native Associations

For SAP HANA, CDS associations are by default reflected in the respective database tables and views
by _Native HANA Associations_ (HANA SQL clause `WITH ASSOCIATIONS`).

CAP no longer needs these native associations (provided you use the new database
service _@cap-js/hana_ for the CAP Node.js stack).

Unless you explicitly use them in other native HANA objects, we recommend
switching off the generation of native HANA associations, as they increase deploy times:
In previous CAP releases, CDS associations were by default reflected in the respective SAP HANA
database tables and views by _Native HANA Associations_ (HANA SQL clause `WITH ASSOCIATIONS`).
But the presence of such native associations increases (re-)deploy times:
They need to be validated in the HDI deployment, and they can introduce
indirect dependencies between other objects, which can trigger other unnecessary revalidations
or even unnecessary drop/create of indexes. By switching them off, all this effort is saved.
or even unnecessary drop/create of indexes.

As CAP doesn't need these native associations, by default no native HANA associations
are created anymore starting with CAP 9.

In the unlikely case that you explicitly use them in other native HANA objects or in custom code,
you can switch them back on:

::: code-group

```json [package.json]
{
"cds": {
"sql": {
"native_hana_associations": false
"native_hana_associations": true
}
}
}
Expand All @@ -686,21 +687,18 @@ or even unnecessary drop/create of indexes. By switching them off, all this effo
```json [cdsrc.json]
{
"sql": {
"native_hana_associations": false
"native_hana_associations": true
}
}
```

:::


For new projects, `cds add hana` automatically adds this configuration.

::: warning Initial full table migration
Be aware, that the first deployment after this **configuration change may take longer**.
Be aware that the first deployment after this **configuration change may take longer**.

For each entity with associations, the respective database object will be touched
(DROP/CREATE for views, full table migration via shadow table and data copy for tables).
This is also the reason why we haven't changed the default so far.
Subsequent deployments will benefit, however.

:::