@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
@Transactional
public String processSubmit(@PathVariable Long id, @ModelAttribute("survey") Survey survey, BindingResult result, SessionStatus status) {
status.setComplete();
Customer customer = customerRepository.findOne(id);
if (customer.getSurveyInfo() == null) {
customer.setSurveyInfo(new SurveyInfo());
}
if (survey.getQuestion() != null && survey.getQuestion().trim().length() > 0) {
customer.getSurveyInfo().addQuestionsAndAnswer(survey);
customerRepository.save(customer);
}
return "redirect:/customer/" + id;
}