views:

741

answers:

1

Is there a difference between :

  • @Cascade(org.hibernate.annotations.CascadeType.REMOVE) and
  • @Cascade(org.hibernate.annotations.CascadeType.DELETE) ?
+3  A: 

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.

ChssPly76
Good Chss, congratulations.
Arthur Ronald F D Garcia