message -> group
unidirectional many-to-many
As expected, deleting a group must result removing of the corresponding entries in its association table with message. Since there is no way to navigate from group back to the messages it is referenced, to implement the functionality is the only way to find all messages having sets including to-be-deleted group and update their set and save ?
It is as easy as a single delete command in sql with on delete cascade constraints on foreign keys, but I think there is no way to tell this to hibernate since on-delete=cascade is only enabled for inverse one-to-many associations (as exception says).
Thanks in advance.
MB
|