Skip to content

Commit 775fc37

Browse files
Java: Document changelog deletion (#1969)
Explains how stakeholder opts-in for changelog deletion together with their entities. --------- Co-authored-by: René Jeglinsky <rene.jeglinsky@sap.com>
1 parent 4a6f13d commit 775fc37

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

java/change-tracking.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,22 @@ Each entry in the `Changes` entity contains the following information:
311311
- The data type of the changed attribute.
312312
- The technical path from the root entity to the tracked target entity.
313313

314+
By default, changes remain in your database even when their entities are deleted.
315+
316+
If you want to delete changelogs together with your entities, your **domain entity** must be extended with the `changelog.changeTracked` aspect.
317+
318+
To enable the deletion of changes per entity, annotate your domain entity like this:
319+
320+
```cds
321+
annotate model.Books.changes:change with @cascade: { delete };
322+
```
323+
324+
To enable deletion of changes for all entities in the model, add the following annotation to your model:
325+
326+
```cds
327+
annotate sap.changelog.ChangeLink:change with @cascade: { delete };
328+
```
329+
314330
## Detection of Changes
315331

316332
The change tracking intercepts the modifying CQL statements (`Insert`, `Upsert`, `Update`, and `Delete`) and

0 commit comments

Comments
 (0)