Skip to content

Java: cascade.delete hint #1986

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions java/working-with-cql/query-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,16 @@ The [delete](./query-api) operation is cascaded along the entity's compositions.
The following example deletes the order with ID *1000* including all its items:

```java
CqnDelete delete = Delete.from("bookshop.Orders").matching(singletonMap("OrderNo", 1000));
long deleteCount = service.run(delete).rowCount();
long deleteCount = service.run(Delete.from("bookshop.Orders").byId(1000)).rowCount();
```

::: tip
To disable cascade delete for a specific Delete statement, add a hint(#hana-hints):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#hana-hints

this is a DB-independent hint. The section targeted by the link is named "Query Hints". Hence I think this is OK. However, I think the section "Query Hints" could also mention query-independent hints:

Quer Hints

Runtime Hints

DB-specific Hints


I also think we should introduce "hana." as a synonymn for the "hdb." prefix. Would be more natural.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the hint section should not be specific to HANA: #1942

```Java
Delete.from("bookshop.Orders").byId(1000).hint("cascade.delete", false);
```
:::

## Views and Projections { #views }

With CDS [views](../../cds/cdl#views-projections) you can derive new entities from existing ones, for example to rename or exclude certain elements, or to add [virtual elements](../../cds/cdl#virtual-elements-in-views) for specific use cases.
Expand Down