Updating tasks entity directly in db using scripts is not a good practice, which leads to data inconsistency and transactional issues.
Rather than this approach, I would suggest standard approach to handle/complete the tasks using Java API/Rest API to handle the tasks without any issues.
-
REST API: Rest Api Reference | docs.camunda.org
-
For Java API you can use process engine services like RuntimeService, TaskService, HistoryService, etc.
Example:
@Autowired
private TaskService taskService;
public void completeTask(String taskId, Map<String, Object> processVariables) {
taskService.complete(taskId, processVariables);
}