From bc6627baca93a8daae54ed5eb132e2e9cb97d788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Tue, 7 Nov 2023 18:56:30 +0100 Subject: [PATCH 1/4] Update persistence-services.md Document config for SAP HANA HEX Engine --- java/persistence-services.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/java/persistence-services.md b/java/persistence-services.md index 8804c1a0b..0fbc8b0aa 100644 --- a/java/persistence-services.md +++ b/java/persistence-services.md @@ -121,10 +121,27 @@ cds: ### SAP HANA +#### Service Bindings + SAP HANA can be configured when running locally as well as when running productively in the cloud. The datasource is auto-configured based on available service bindings in the `VCAP_SERVICES` environment variable or locally the _default-env.json_. This only works if an application profile is used, that doesn't explicitly configure a datasource using `spring.datasource.url`. Such an explicit configuration always takes precedence over service bindings from the environment. Service bindings of type *service-manager* and, in a Spring-based application, *hana* are used to auto-configure datasources. If multiple datasources are used by the application, you can select one auto-configured datasource to be used by the default Persistence Service through the property `cds.dataSource.binding`. +#### SQL Optimization Mode + +By default, CAP Java generates SQL in `legacy` _optimization mode_, which is compatible with SAP HANA Cloud Edition as well as with HANA 2.x (HANA as a Service). If your deployment target is SAP HANA Cloud Edition you can also specifiy the optimization mode `hex`. In `hex` mode, CAP generates SQL that will _only_ run on the [HEX engine](https://help.sap.com/docs/SAP_HANA_PLATFORM/9de0171a6027400bb3b9bee385222eff/3861d0908ef14e8bbec1d76ea871ac0f.html#sap-hana-execution-engine-(hex)) of SAP HANA Cloud Edition: + +```yaml +cds: + sql: + hana: + optimizationMode: hex +``` + +:::tip +Use the [hints](.../java/query-execution#hana-hints) `hdb.USE_HEX_PLAN` and `hdb.NO_USE_HEX_PLAN` to overrule the configured optimization mode per statement. +::: + ### PostgreSQL { #postgresql-1 } PostgreSQL can be configured when running locally as well as when running productively in the cloud. Similar to HANA, the datasource is auto-configured based on available service bindings, if the feature `cds-feature-postgresql` is added. From 9dc50e4ac6aa900ea189a917e2db9ca112ddd0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Thu, 9 Nov 2023 14:59:56 +0100 Subject: [PATCH 2/4] Update java/persistence-services.md --- java/persistence-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/persistence-services.md b/java/persistence-services.md index 0fbc8b0aa..91b367680 100644 --- a/java/persistence-services.md +++ b/java/persistence-services.md @@ -139,7 +139,7 @@ cds: ``` :::tip -Use the [hints](.../java/query-execution#hana-hints) `hdb.USE_HEX_PLAN` and `hdb.NO_USE_HEX_PLAN` to overrule the configured optimization mode per statement. +Use the [hints](../java/query-execution#hana-hints) `hdb.USE_HEX_PLAN` and `hdb.NO_USE_HEX_PLAN` to overrule the configured optimization mode per statement. ::: ### PostgreSQL { #postgresql-1 } From 9386a7a80b54ac9746632eb6bdb36450c200b19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20G=C3=B6rler?= Date: Tue, 14 Nov 2023 17:11:25 +0100 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Matthias Schur <107557548+MattSchur@users.noreply.github.com> --- java/persistence-services.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/java/persistence-services.md b/java/persistence-services.md index 91b367680..9e1be21b5 100644 --- a/java/persistence-services.md +++ b/java/persistence-services.md @@ -129,13 +129,11 @@ Service bindings of type *service-manager* and, in a Spring-based application, * #### SQL Optimization Mode -By default, CAP Java generates SQL in `legacy` _optimization mode_, which is compatible with SAP HANA Cloud Edition as well as with HANA 2.x (HANA as a Service). If your deployment target is SAP HANA Cloud Edition you can also specifiy the optimization mode `hex`. In `hex` mode, CAP generates SQL that will _only_ run on the [HEX engine](https://help.sap.com/docs/SAP_HANA_PLATFORM/9de0171a6027400bb3b9bee385222eff/3861d0908ef14e8bbec1d76ea871ac0f.html#sap-hana-execution-engine-(hex)) of SAP HANA Cloud Edition: +By default, the SAP HANA adapter in CAP Java generates SQL that is compatible with SAP HANA 2.x ([HANA Service](https://help.sap.com/docs/HANA_SERVICE_CF/6a504812672d48ba865f4f4b268a881e/08c6e596b53843ad97ae68c2d2c237bc.html)) and [SAP HANA Cloud](https://www.sap.com/products/technology-platform/hana.html). +To generate SQL that is optimized for the new [HEX engine](https://help.sap.com/docs/SAP_HANA_PLATFORM/9de0171a6027400bb3b9bee385222eff/3861d0908ef14e8bbec1d76ea871ac0f.html#sap-hana-execution-engine-(hex)) in SAP HANA Cloud, set the [CDS property](../development/properties#cds-properties): ```yaml -cds: - sql: - hana: - optimizationMode: hex +cds.sql.hana.optimizationMode: hex ``` :::tip From e2a94b24ab663c618575419c791df282aebbcb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Jeglinsky?= Date: Tue, 14 Nov 2023 19:25:50 +0100 Subject: [PATCH 4/4] Update java/persistence-services.md --- java/persistence-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/persistence-services.md b/java/persistence-services.md index 9e1be21b5..41e6de6cd 100644 --- a/java/persistence-services.md +++ b/java/persistence-services.md @@ -130,7 +130,7 @@ Service bindings of type *service-manager* and, in a Spring-based application, * #### SQL Optimization Mode By default, the SAP HANA adapter in CAP Java generates SQL that is compatible with SAP HANA 2.x ([HANA Service](https://help.sap.com/docs/HANA_SERVICE_CF/6a504812672d48ba865f4f4b268a881e/08c6e596b53843ad97ae68c2d2c237bc.html)) and [SAP HANA Cloud](https://www.sap.com/products/technology-platform/hana.html). -To generate SQL that is optimized for the new [HEX engine](https://help.sap.com/docs/SAP_HANA_PLATFORM/9de0171a6027400bb3b9bee385222eff/3861d0908ef14e8bbec1d76ea871ac0f.html#sap-hana-execution-engine-(hex)) in SAP HANA Cloud, set the [CDS property](../development/properties#cds-properties): +To generate SQL that is optimized for the new [HEX engine](https://help.sap.com/docs/SAP_HANA_PLATFORM/9de0171a6027400bb3b9bee385222eff/3861d0908ef14e8bbec1d76ea871ac0f.html#sap-hana-execution-engine-(hex)) in SAP HANA Cloud, set the [CDS property](development/properties#cds-properties): ```yaml cds.sql.hana.optimizationMode: hex