I developed a CRUD in spring using thymeleaf. Everything is working. Some tables have OneToOne and ManyToOne relationships. And every time I delete a row from the news table for example, it also deletes from the author table. How do I prevent this?
NewsServiceImplement:
@Override
public void delete(Long id) {
repository.deleteById(id);
}
DashNewsController:
// Delete
@RequestMapping("/dashboard/noticias/deletar/{id}")
public String destroy(@PathVariable("id") Long id) {
noticiaService.delete(id);
return "redirect:/dashboard/noticias";
}