SOURCE CODE (GitHub Link)
https://github.com/VikramThakur8/Enqu...
PURPOSE:
This video covers - How to Delete Enquiry Record using Spring-JPA through @Transactional Annotation. Spring Data JPA makes database handing so easy for java developer. Thymeleaf Template is used in UI.
SOURCE CODE REFERENCE:
1. Controller Method:
@GetMapping("/enquiry-detail/{id}")
public String enquiryDetail(@PathVariable Long id, Model m){
m.addAttribute("dataMap", enquiryRepository.getEnquiryDetailMap(id));
m.addAttribute("followupList", followupRepository.getFollowupsByEnquiryId(id));
return "/enquiry-detail"; //html
}
2. CommonService Method:
@Transactional
public void deleteEnquiry(Long enquiryId){
Enquiry enquiry = enquiryRepository.findById(enquiryId).get();
Contact contact = enquiry.getContact();
//delete contact
contactRepository.delete(contact);
//delete enquiry
enquiryRepository.delete(enquiry);
}
3. THYMELEAF TEMPLATE REFERENCE CODE:
Download from GitHub Link mentioned above.
TECHNOLOGY USED:
Java 8, Spring Boot, Spring Data JPA, MySQL Database, NetBeans IDE, Hibernate JPA Implementation, Maven, MySQL Workbench, JSON, MicroServices.
PREVIOUS VIDEO IN CASE YOU MISSED:
• 11 - Spring Data JPA | Spring Boot | Proje...