0
votes

Many people like to compare between inverse and cascade, but both are totally different notions (at the bottom of this page).

In Hibernate, only the “relationship owner” should maintain the relationship, and the “inverse” keyword is created to define which side is the owner to maintain the relationship. However the “inverse” keyword itself is not verbose enough.

In few articles, they even suggested that just forget about what is “inverse”, and always put inverse=”true” in the collection variable.

I was going through the link mentioned above but I didn't understand the difference between cascade and inverse in Hibernate (at least the sentence in the boldface letter). Could you please explain that difference?

Also seen this question.

In case of many-to-many relation through intermediary table; "Cascade" says whether record will be created/updated in child table. Whereas "Inverse" says whether record will be created/updated in intermediary table

What does it mean "created/updated in intermediarytable"?

1

1 Answers

0
votes

The answer in the link that you added is great. look on the one that marked as the right answer. the one that you asked about is confusing and you dont need to think on it. the example that he give there are symptoms, but no the root of the difference. cascade and inverse are 2 different keyword. The explain in the first answer is great and clear. read it and ignore the others.