How can I update a active task due date

I have created a task and assigned to user with due date set. User wants an extension. How to update the task with due date for a task ID??

I have been trying this but not working

TaskEntity oldTask = (TaskEntity) taskService.newTask(taskId);
oldTask.setDueDate(dueDate);

When I add

taskService.saveTask(oldTask);

It gives fatal error of Duplicate Primary Key for task ID passed. I think it is trying to create a new task with same task ID but I want to update.

I need help. Please guide me.

Awaiting for a response.

Thanks.

Hi,

use:
TaskServicel#setDueDate

Martin

Thanks martin. It worked.