Can anyone help me what is the exact funtionality of cascade="delete-orphan?
It is like when a parent is deleted, all childs associated with a parent will not be deleted or will be deleted?
Can anyone help me what is the exact funtionality of cascade="delete-orphan?
It is like when a parent is deleted, all childs associated with a parent will not be deleted or will be deleted?
Opening the documentation and searching for "delete-orphan" in the text leads to the following explanation:
A special cascade style, delete-orphan, applies only to one-to-many associations, and indicates that the delete() operation should be applied to any child object that is removed from the association. Using annotations there is no CascadeType.DELETE-ORPHAN equivalent. Instead you can use the attribute orphanRemoval as seen in Example 11.4, “@OneToMany with orphanRemoval”. If an entity is removed from a @OneToMany collection or an associated entity is dereferenced from a @OneToOne association, this associated entity can be marked for deletion if orphanRemoval is set to true.
The documentation is your friend. Read it.