Hibernate: OnDelete vs cascade = CascadeType.REMOVE

What is the difference between @OnDelete(action=OnDeleteAction.CASCADE) and cascade=CascadeType.REMOVE

I read here: Is there an equivalent annotation for OnDelete in JPA2 that with @OnDelete(action=OnDeleteAction.CASCADE) cascade will be processed by the database, and with cascade=CascadeType.REMOVE cascade will be processed by ORM (Hibernate).

  • Could you explain what is the difference between Hibernate processing and DB processing? How is the "DB" done?

  • In addition, I would like to know why I should consider the difference. I mean, why should I choose one relationship to another.

  • Last question, looking at OnDelete javadoc I was wondering why it doesn’t say anything about what it does and why I should use it (BTW where is the inheritance path?). So where are these points documented?

+4
database annotations hibernate jpa
source share
1 answer

1-Some option of cascading database support and some databases do not have: If the cascade of database support, then hibernate will accordingly create a schema and allow the database to handle cascading operations.

2-If the database descriptor cascade uses it, another vice-governor must query the database and this will lose performance.

3-Idea

0
source share

All Articles