Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between REMOVE and DELETE?

Is there a difference between :

  • @Cascade(org.hibernate.annotations.CascadeType.REMOVE) and
  • @Cascade(org.hibernate.annotations.CascadeType.DELETE) ?

1 Answers

There is no difference; they're synonyms.

Documentation is rather silent on this but if you look at AnnotationBinder.getCascadeStrategy() source, both are being translated to Hibernate's "delete" cascade type.

The reason that both exist (and I'm guessing here) is because Hibernate core has always used "DELETE" as cascade type, but JPA's CascadeType specifies "REMOVE" as a constant. Hibernate Annotations' CascadeType, being part of Hibernate's JPA extension thus has both for completeness / consistency.

like image 62
ChssPly76 Avatar answered Sep 15 '25 12:09

ChssPly76