Buggy code:
public static final String ATTR_TASK = Task . OBJECT_NAME ; public static final String ATTR_ASSIGN_PROJECT_ID = "assignProjectID" ; public static final String ATTR_ASSIGN_STAFF_ID = "assignStaffID" ; public static final String JSP_LIST = "taskList" ; public static final String JSP_EDIT = "taskEdit" ; private TaskService taskService ; private TeamService teamService ; private StaffService staffService ; private FieldService fieldService ; private ProjectService projectService ; @ Autowired ( required = true ) @ Qualifier ( "projectService" ) public void setProjectService ( ProjectService s ) { } @ Autowired ( required = true ) @ Qualifier ( "taskService" ) public void setTaskService ( TaskService s ) { } @ Autowired ( required = true ) @ Qualifier ( "fieldService" ) public void setFieldService ( FieldService s ) { } @ Autowired ( required = true ) @ Qualifier ( "staffService" ) public void setStaffService ( StaffService s ) { } @ Autowired ( required = true ) @ Qualifier ( "teamService" ) public void setTeamService ( TeamService s ) { } @ RequestMapping ( value = { SystemConstants . REQUEST_ROOT , SystemConstants . REQUEST_LIST } , method = RequestMethod . GET ) public String listTasks ( Model model ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_PROJECT_EDITOR ) ) + "')" ) @ RequestMapping ( value = ( ( SystemConstants . REQUEST_CREATE ) + "//" ) + ( Project . OBJECT_NAME ) , method = RequestMethod . POST ) public String createWithProject ( @ ModelAttribute ( TaskController . ATTR_TASK ) Task task , @ RequestParam ( value = SystemConstants . ORIGIN , required = false ) String origin , @ RequestParam ( value = SystemConstants . ORIGIN_ID , required = false ) long originID ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_TASK_EDITOR ) ) + "')" ) @ RequestMapping ( value = SystemConstants . REQUEST_CREATE , method = RequestMethod . POST ) public String create ( @ ModelAttribute ( TaskController . ATTR_TASK ) Task task ) { if ( ( task . getId ( ) ) == 0 ) { this . taskService . create ( task ) ; return ( ( ( SystemConstants . CONTROLLER_REDIRECT ) + ( TaskController . ATTR_TASK ) ) + "//" ) + ( SystemConstants . REQUEST_LIST ) ; } else { <START_BUG> this . taskService . update ( task ) ; <END_BUG> return ( ( ( ( ( SystemConstants . CONTROLLER_REDIRECT ) + ( TaskController . ATTR_TASK ) ) + "//" ) + ( SystemConstants . REQUEST_EDIT ) ) + "//" ) + ( task . getId ( ) ) ; } } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_PROJECT_EDITOR ) ) + "')" ) @ RequestMapping ( value = ( ( ( ( SystemConstants . REQUEST_ASSIGN ) + "//" ) + ( SystemConstants . FROM ) ) + "//" ) + ( Project . OBJECT_NAME ) , method = RequestMethod . POST ) public String redirectAssignProject ( @ RequestParam ( Project . COLUMN_PRIMARY_KEY ) long projectID , @ RequestParam ( value = SystemConstants . ORIGIN , required = false ) String origin , @ RequestParam ( value = SystemConstants . ORIGIN_ID , required = false ) long originID , Model model ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_PROJECT_EDITOR ) ) + "')" ) @ RequestMapping ( value = { SystemConstants . REQUEST_ASSIGN_PROJECT , ( ( ( SystemConstants . REQUEST_ASSIGN_PROJECT ) + "//{" ) + ( Project . COLUMN_PRIMARY_KEY ) ) + "}" } , method = RequestMethod . POST ) public ModelAndView assignProject ( @ ModelAttribute ( TaskController . ATTR_TASK ) Task task , @ PathVariable ( Project . COLUMN_PRIMARY_KEY ) int projectID ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_STAFF_EDITOR ) ) + "')" ) @ RequestMapping ( ( ( ( ( ( SystemConstants . REQUEST_ASSIGN ) + "//" ) + ( Staff . OBJECT_NAME ) ) + "//{" ) + ( Staff . COLUMN_PRIMARY_KEY ) ) + "}" ) public String redirectAssignStaff ( @ PathVariable ( Staff . COLUMN_PRIMARY_KEY ) int id , Model model ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_STAFF_EDITOR ) ) + "')" ) @ RequestMapping ( value = { ( ( ( ( ( ( ( SystemConstants . REQUEST_ASSIGN ) + "//" ) + ( SystemConstants . NEW ) ) + "//" ) + ( Staff . OBJECT_NAME ) ) + "//{" ) + ( Staff . COLUMN_PRIMARY_KEY ) ) + "}" } , method = RequestMethod . POST ) public ModelAndView assignStaff ( @ ModelAttribute ( TaskController . ATTR_TASK ) Task task , @ PathVariable ( Staff . COLUMN_PRIMARY_KEY ) int staffID ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_TASK_EDITOR ) ) + "')" ) @ RequestMapping ( ( ( ( "//" + ( SystemConstants . REQUEST_DELETE ) ) + "//{" ) + ( Task . COLUMN_PRIMARY_KEY ) ) + "}" ) public String delete ( @ PathVariable ( Task . COLUMN_PRIMARY_KEY ) int id ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_TASK_EDITOR ) ) + "')" ) @ RequestMapping ( SystemConstants . REQUEST_MARK ) public ModelAndView mark ( @ RequestParam ( Task . COLUMN_PRIMARY_KEY ) long taskID , @ RequestParam ( Task . COLUMN_STATUS ) int status ) { } @ PreAuthorize ( ( "hasRole('" + ( SystemConstants . ROLE_PROJECT_EDITOR ) ) + "')" ) @ RequestMapping ( ( ( SystemConstants . REQUEST_MARK ) + "//" ) + ( Project . OBJECT_NAME ) ) public ModelAndView markProject ( @ RequestParam ( Project . COLUMN_PRIMARY_KEY ) long projectID , @ RequestParam ( Task . COLUMN_PRIMARY_KEY ) long taskID , @ RequestParam ( Task . COLUMN_STATUS ) int status ) { } @ RequestMapping ( ( ( ( "//" + ( SystemConstants . REQUEST_EDIT ) ) + "//{" ) + ( Task . COLUMN_PRIMARY_KEY ) ) + "}"

Fix:
this . taskService . merge ( task ) ;