Skip to main content

Cascade Types and orphanRemoval

Learn Cascade Types and orphanRemoval (Spring Data JPA, Spring Boot) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

The Problem Cascade Solves An Order has many OrderLine s. Without cascading you must save the order, then loop and save every line yourself, and delete the lines before deleting the order. Cascade tells JPA: "when I do this operation to the parent, do it to the children too."

More lessons in Spring Data JPA