Skip to content

Cascade Delete

Gal Koren edited this page Nov 12, 2020 · 1 revision

In the previous page we saw how to add a child flow to the parent flow.
Given that, we can delete a parent with a "cascade" flag turned on which will delete all of its children.

var campaignCmd = new DeleteEntityCommand(CampaignEntity.INSTANCE, new CampaignEntity.Id(123))
    .setCascade(); // <------- that's the trick

campaignPersistence.delete(asList(campaignCmd));