500 Internal Error

The Students are updating but i am getting this error after clicking to update button . This are the both controller
@GetMapping("/edit")
public String getUpdateStudent(@RequestParam Long roll_no, @RequestParam Long bookId, Model model) {
log.info("Received roll_no: {}, bookId: {}", roll_no, bookId);
StudentDetailUpdate studentDetailUpdate = new StudentDetailUpdate();
model.addAttribute("roll_no", roll_no);
model.addAttribute("bookId", bookId);
model.addAttribute("studentDetails", studentDetailUpdate);
return "updatestudent";
}

@PostMapping("/updatestudent")
public String updateStudent(@Valid @ModelAttribute("studentDetails") StudentDetailUpdate studentDetailUpdate,
BindingResult result, Model model) {

log.info("Updating student with roll_no: {}, bookId: {}", studentDetailUpdate.getRoll_no(),
studentDetailUpdate.getBookId());

if (result.hasErrors()) {
return "updatestudent";
}

try {
studentDetailsService.updateStudentNameAndReturnDate(studentDetailUpdate.getRoll_no(),
studentDetailUpdate.getBookId(), studentDetailUpdate.getName(),
studentDetailUpdate.getReturnDate());

return "viewmore";

} catch (StudentNotFound | ResourceNotFoundException e) {
return "updatestudent";
}
}
@GetMapping("/edit")
public String getUpdateStudent(@RequestParam Long roll_no, @RequestParam Long bookId, Model model) {
log.info("Received roll_no: {}, bookId: {}", roll_no, bookId);
StudentDetailUpdate studentDetailUpdate = new StudentDetailUpdate();
model.addAttribute("roll_no", roll_no);
model.addAttribute("bookId", bookId);
model.addAttribute("studentDetails", studentDetailUpdate);
return "updatestudent";
}

@PostMapping("/updatestudent")
public String updateStudent(@Valid @ModelAttribute("studentDetails") StudentDetailUpdate studentDetailUpdate,
BindingResult result, Model model) {

log.info("Updating student with roll_no: {}, bookId: {}", studentDetailUpdate.getRoll_no(),
studentDetailUpdate.getBookId());

if (result.hasErrors()) {
return "updatestudent";
}

try {
studentDetailsService.updateStudentNameAndReturnDate(studentDetailUpdate.getRoll_no(),
studentDetailUpdate.getBookId(), studentDetailUpdate.getName(),
studentDetailUpdate.getReturnDate());

return "viewmore";

} catch (StudentNotFound | ResourceNotFoundException e) {
return "updatestudent";
}
}
Can Anyone Help !
No description
3 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Danix! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2mo ago
Can you please show the full stack trace as text (not using images)?
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server