private Schedule mapData(ResultSet rs) throws SQLException { Schedule schedule = new Schedule(); schedule.setApplicantId(rs.getInt("applicant_id")); schedule.setInterviewer(rs.getInt("interviewer")); schedule.setMessageForApplicant(rs.getString("message_for_applicant")); schedule.setMessageForInterviewer(rs.getString("message_for_interviewer")); schedule.setRemarks(rs.getString("remarks")); schedule.setScheduleDate(rs.getDate("schedule_date")); schedule.setScheduleTime(rs.getTime("schedule_time")); schedule.setEditDate(rs.getDate("edit_date")); schedule.setScheduleId(rs.getInt("schedule_id")); schedule.setScheduleStatus(rs.getBoolean("schedule_status")); /*if(rs.getTime("schedule_time")!=null){ schedule.setScheduleTime(rs.getTime("schedule_time")); }*/ return schedule; }
@RequestMapping(value = "update", method = RequestMethod.POST) public String update( @ModelAttribute(value = "Schedule") Schedule schedule, @Context HttpServletRequest request) throws ParseException { schedule.setScheduleId(Integer.parseInt(request.getParameter("id"))); DateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd"); Date formatedDate = formatDate.parse(request.getParameter("schedule_date")); schedule.setScheduleDate(formatedDate); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); Date SimpleDateFormat = sdf.parse(request.getParameter("schedule_time")); schedule.setScheduleTime(SimpleDateFormat); Calendar calendar = Calendar.getInstance(); schedule.setEditDate(calendar.getTime()); scheduleService.update(schedule); return "redirect:/admin/schedule"; }