From 9e6460defb8df55d10d01c1b2336fd652e556f72 Mon Sep 17 00:00:00 2001 From: Eckart Liemke Date: Thu, 9 Jul 2026 15:40:58 +0200 Subject: [PATCH 1/4] Some more hints for HANA tenant id generation --- guides/multitenancy/index.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index 09600d962..d09c6cc4f 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -901,6 +901,13 @@ The cds/requires/cds.xt. The prefix and subscriber tenant name are each limited to 63 characters maximum. ::: +:::warning `hana_tenant_prefix` is only used to generate the SAP HANA tenant UUID +The `hana_tenant_prefix` is only used to generate the SAP HANA tenant UUID to avoid duplicates when creating a +SAP HANA tenant. Although it is added as `prefix` label to the SAP HANA tenant, it is not reliable and must not +be used for any query. +operation. +::: + ##### Mandatory for CAP Java Applications For **CAP Java** applications you need to set the same prefix in the cds.multitenancy.hanaMtService.hanaTenantPrefix property. We recommend doing this using the environment variable in the _mta.yaml_: @@ -922,10 +929,14 @@ To group the tenant containers of many applications or microservices in a common **Option 1: Configure the same `hana_tenant_prefix`** : You can configure the same [`hana_tenant_prefix`](#mandatory-specify-a-unique-prefix-for-the-sap-hana-tenant-name) many applications or microservices. With that, the SAP HANA tenant ID is generated in the same way for each subscriber tenant. +: If you choose this options, the following preconditions need to be met +- The subscriber tenant ID (BTP tenant ID) needs to be the same for all applications or microservices. +- All applciations or microservices need to use the [same database](#configure-mtxs-for-tenant-management-service). + **Option 2: Pass the SAP HANA Tenant ID with a Subscription** : **... in CAP Node.js** - + If you want to control the ID of the SAP HANA tenant ID on your own, you can pass it as subscription payload as parameters, for example, using a handler for the [`SaasRegistryService`](./mtxs#put-tenant): ```jsonc { @@ -943,12 +954,12 @@ To group the tenant containers of many applications or microservices in a common } ``` The `hana_tenant_id` must be a valid UUID and must be unique per subscriber tenant. Specifying `hana_tenant_id` overrides the prefix settings mentioned earlier, - except for the internal tenant `t0`. Also ensure that the ID is unique within a region. - + except for the internal tenant `t0`. Also ensure that the ID is unique within a region. + : **... in CAP Java** To specify the ID of the SAP HANA tenant in **CAP Java** applications you can register a custom handler for the `before` phase of the `SUBSCRIBE` event that sets the `hana_tenant_id` within the provisioning parameters: - + ```java @Before public void beforeSubscription(SubscribeEventContext context) { @@ -956,9 +967,9 @@ To group the tenant containers of many applications or microservices in a common Collections.singletonMap("hana_tenant_id", "")); } ``` - + This will affect every new [tenant subscription](../../java/multitenancy.md#subscribe-tenant) and will set the specified SAP HANA tenant ID. - +
From 07cb1a0a48d9e02581cec620b059d9226a902de5 Mon Sep 17 00:00:00 2001 From: Rene Jeglinsky Date: Fri, 10 Jul 2026 11:45:06 +0200 Subject: [PATCH 2/4] fix typo --- guides/multitenancy/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index 66134af51..7dced0c53 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -930,7 +930,7 @@ To group the tenant containers of many applications or microservices in a common : If you choose this options, the following preconditions need to be met - The subscriber tenant ID (BTP tenant ID) needs to be the same for all applications or microservices. -- All applciations or microservices need to use the [same database](#configure-mtxs-for-tenant-management-service). +- All applications or microservices need to use the [same database](#configure-mtxs-for-tenant-management-service). **Option 2: Pass the SAP HANA Tenant ID with a Subscription** From 4abbc73423bdda0feb2f9f4d38bd7dc71bf929b1 Mon Sep 17 00:00:00 2001 From: ecklie <52252271+ecklie@users.noreply.github.com> Date: Fri, 10 Jul 2026 13:36:33 +0200 Subject: [PATCH 3/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: René Jeglinsky --- guides/multitenancy/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index 7dced0c53..f68c6a562 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -901,7 +901,7 @@ The cds/requires/cds.xt. The prefix and subscriber tenant name are each limited to 63 characters maximum. ::: -:::warning `hana_tenant_prefix` is only used to generate the SAP HANA tenant UUID +:::warning Do not use `hana_tenant_prefix` in queries The `hana_tenant_prefix` is only used to generate the SAP HANA tenant UUID to avoid duplicates when creating a SAP HANA tenant. Although it is added as `prefix` label to the SAP HANA tenant, it is not reliable and must not be used for any query. From db1bb4181fd8fb4b593bb8a37b26d88411b47b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Mon, 13 Jul 2026 15:22:29 +0200 Subject: [PATCH 4/4] Apply suggestion from @renejeglinsky --- guides/multitenancy/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/multitenancy/index.md b/guides/multitenancy/index.md index f68c6a562..83f6d9161 100644 --- a/guides/multitenancy/index.md +++ b/guides/multitenancy/index.md @@ -902,7 +902,7 @@ The prefix and subscriber tenant name are each limited to 63 characters maximum. ::: :::warning Do not use `hana_tenant_prefix` in queries -The `hana_tenant_prefix` is only used to generate the SAP HANA tenant UUID to avoid duplicates when creating a +The `hana_tenant_prefix` is only used to generate the SAP HANA tenant UUID to avoid duplicates when creating an SAP HANA tenant. Although it is added as `prefix` label to the SAP HANA tenant, it is not reliable and must not be used for any query. :::