Question

Is there a difference between :

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

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top