views:

82

answers:

1

how to use cascade and inverse in hibernate, what is the procedure/tag to define them? is they relate to each other? how they are useful in hibernate...

A: 

Information referenced from Different between cascade and inverse link:

1. inverse: This is used to decide which side is the relationship owner to manage the relationship (insert or update of the foreign key column).

2. cascade: In cascade, after one operation (save, update and delete) is done, it decide whether it need to call other operations (save, update and delete) on another entities which has relationship with each other.

Conclusion: In short, the “inverse” is decide which side will update the foreign key, while “cascade” is decide what’s the follow by operation should execute. Both are look quite similar in relationship, but it’s totally two different things. Hibernate developers are worth to spend time to research on it, because misunderstand the concept or misuse it will bring serious performance or data integrity issue in your application.

Also check this forumn topic: https://forum.hibernate.org/viewtopic.php?f=1&t=949041

YoK