advancedRelationships — @OneToMany, @ManyToOne, @ManyToMany, Cascade & FetchType
Why is defaulting every relationship to CascadeType.ALL a common real production mistake?
CascadeType.ALL propagates persist/merge/remove from parent to every child automatically — appropriate for genuine "part-of" ownership (an Order's LineItems), but applied broadly and by default, it can cause an accidental cascading delete on a relationship that was never meant to propagate removal, such as deleting a Customer because one of their many Orders was removed.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.
Why is defaulting every relationship to CascadeType.ALL a common real production mistake?