У нас вы можете посмотреть бесплатно Cascade REMOVE & orphanRemoval in Spring Boot | One-to-One JPA Explained или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In this video, we continue the One-to-One relationship series in Spring Boot and explore what happens when relationships are deleted or broken. Previously, we learned how to persist Employee and IdCard using Cascade PERSIST. Now we will understand how deletion works and why orphanRemoval is important. Topics covered in this video: 1️⃣ Cascade REMOVE When we delete an Employee, the related IdCard is automatically deleted if CascadeType.REMOVE (or CascadeType.ALL) is enabled. Example: employeeRepository.delete(employee); Result: The associated IdCard row is also deleted. 2️⃣ orphanRemoval = true If the relationship is broken: employee.setIdCard(null); After saving the employee, the IdCard becomes an orphan and is automatically deleted from the database. Important difference: Cascade REMOVE → triggered when parent is deleted orphanRemoval → triggered when relationship is broken 3️⃣ @JsonIgnore Bidirectional relationships can cause infinite JSON recursion: Employee → IdCard → Employee → IdCard → ... This breaks REST serialization. Solution: Use @JsonIgnore on one side of the relationship to prevent recursive serialization. This video demonstrates these behaviors step-by-step using Spring Boot REST APIs. Next videos will explore more advanced relationship behaviors and best practices. GitHub Repository: https://github.com/pateluday07/spring...