@RequestMapping(value = "/customerDelete/{id}") @Transactional public String delete(@PathVariable Long id) { Customer customer = customerRepository.findOne(id); if (customer != null) { customerRepository.delete(customer); } return "redirect:/customer"; }
@RequestMapping(value = "/customerClear/{id}") @Transactional public String clear(@PathVariable Long id) { Customer customer = customerRepository.findOne(id); if (customer != null) { customer.setSurveyInfo(new SurveyInfo()); customerRepository.save(customer); } return "redirect:/customer/" + id; }