diff --git a/java/cqn-services/persistence-services.md b/java/cqn-services/persistence-services.md index ec2c0250f..025bac5c5 100644 --- a/java/cqn-services/persistence-services.md +++ b/java/cqn-services/persistence-services.md @@ -147,7 +147,7 @@ By default, the SAP HANA adapter in CAP Java generates SQL that is optimized for cds.sql.hana.optimizationMode: legacy ``` -Use the [hints](../working-with-cql/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](../working-with-cql/query-execution#query-hints) `hdb.USE_HEX_PLAN` and `hdb.NO_USE_HEX_PLAN` to overrule the configured optimization mode per statement. ::: warning Rare error in `HEX` mode In some corner cases, particularly when using [native HANA views](../../advanced/hana#create-native-sap-hana-objects), queries in `HEX` optimization mode may fail with a "hex enforced but cannot be selected" error. This is the case if the statement execution requires the combination of HEX only features with other features that are not yet supported by the HEX engine. If CAP detects this error it will, as a fallback, execute the query in _legacy_ mode. diff --git a/java/working-with-cql/query-execution.md b/java/working-with-cql/query-execution.md index af60b19a2..857f2db9b 100644 --- a/java/working-with-cql/query-execution.md +++ b/java/working-with-cql/query-execution.md @@ -117,15 +117,15 @@ var params = Map.of("minStock", 100); Result result = service.run(query, params); ``` -#### Adding Query Hints for SAP HANA { #hana-hints} +### Query Hints { #query-hints} -To add a hint clause to a statement, use the `hints` method and prefix the [SAP HANA hints](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c1d3f60099654ecfb3fe36ac93c121bb/4ba9edce1f2347a0b9fcda99879c17a1.htmlS) with `hdb.`: +Use the `hints` method to add specific hints to a CDS QL statement. [SAP HANA hints](https://help.sap.com/docs/HANA_CLOUD_DATABASE/c1d3f60099654ecfb3fe36ac93c121bb/4ba9edce1f2347a0b9fcda99879c17a1.htmlS) need to be prefix with `hdb.` ```java -CqnSelect query = Select.from(BOOKS).hints("hdb.USE_HEX_PLAN", "hdb.ESTIMATION_SAMPLES(0)"); +Select.from(BOOKS).hints("hdb.USE_HEX_PLAN", "hdb.HEX_INDEX_JOIN"); ``` -::: warning -Hints prefixed with `hdb.` are directly rendered into SQL for SAP HANA and therefore **must not** contain external input! +::: danger +Hints prefixed with `hdb.` are directly rendered into SQL for SAP HANA and **must not** contain untrusted input! ::: ### Data Manipulation