code: @Override
    public void deleteProcessInstancesByProcessDefinition(String processDefinitionId, String deleteReason, boolean cascade) {
      List<String> processInstanceIds = executionDataManager.findProcessInstanceIdsByProcessDefinitionId(processDefinitionId);
  
      for (String processInstanceId : processInstanceIds) {
        deleteProcessInstance(processInstanceId, deleteReason, cascade);
      }
  
      if (cascade) {
        getHistoricProcessInstanceEntityManager().deleteHistoricProcessInstanceByProcessDefinitionId(processDefinitionId);
      }
    }
docs: DELETE METHODS