First of all, I want to thank you for the research. I'm not sure if what you have found is what I need. I had written an event before to publish the topic, but it did not work fine...
I'm going to clarify definitely the situation.
Code:
class A {
String idA;
Set<AB> bSet;
// other attributes and get/set methods
}
class AB {
String idA;
String idB;
// M-N relation attributes
}
class B {
String idB;
// other attributes and get/set methods
}
Like M-N relation has attributes, I need to write a class for it.
Notice that relation is unidirectional, I mean, A side looks B (via AB attribute) but B side can't see A side. This is not negotiable.
Now, what happens if I try to delete a B element? if I call delete method in B DAO, it would be responsible to update attribute A.setB, deleting AB elements.
The real problem comes when a B element in deleted in cascade by a parent element. So I need to intercept the deletion and defer A entities form B setting null values and deleting AB elements.
Is now the scenario complete? do you understand what I am oing and why I need to intercept the action?
Like I wrote at the beginning of the topic, DAO calls in a preDelete event does not work and I don't know why.
Any other comment or help about this?
Best regards.