SOURCE CODE (GitHub Link)
https://github.com/VikramThakur8/Enqu...
PURPOSE:
Previous video covered configuration of Thymeleaf Template and Design and CRUD (Create/Save and List/Find/Read) Operation.
This video covers CRUD(Update and Delete) Operations using Spring Data JpaRepository interface. Also covers how intelligently hibernate do update, only when some changes in property-data.
TECHNOLOGY USED:
Java 8, Spring Boot, Spring Data JPA, MySQL Database, NetBeans IDE, Hibernate JPA Implementation, Maven, MySQL Workbench, JSON, MicroServices.
PREVIOUS CRUD VIDEO LINK IN CASE YOU MISSED :
• 3 - Spring Data JPA | Spring Boot | Projec...
SOURCE CODE - Controller
@RequestMapping("/enquiry-source-edit/{id}")
public String edit(@PathVariable Long id , Model model) {
EnquirySource cmd = enquirySourceRepository.findById(id).get();
model.addAttribute("cmd", cmd);
return "/sources"; //sources.html
}
@RequestMapping("/enquiry-source-delete/{id}")
public String delete(@PathVariable Long id) {
enquirySourceRepository.deleteById(id);
return "redirect:/sources";
}