christian wrote:
This way, Hibernate will break, since it can not detect the fact that the database internally deleted some dependent rows by cascading. The in-memory state of a Session can then no longer be synchronized with the database state.
I see. But in the book "Hibernate in Action", chapter 4.3.2, paragraph 4, it mentioned that "...hibernate partially delegates referential integrity concerns to the foreign key constraints of the underlying relational database...". I don't know that works. Could you please give a hint or any URL link where I can learn how partially (or fully if possible) I can solve the referential integrity (e.g., cascade delete or SET NULL on delete) when using hibernate?
One more thing to make sure. Suppose uni-direction association "A-->B". Referential integrity means "when B gets deleted, A should be taken care of (SET NULL or DELETE CASCADE)". But the cascade="delete" of "cascading persistence of hibernate" means "when A gets deleted, B should be taken care of (also deleted)". Am I correct?
Thank you very much for your great help!
Stan