First, if I understand the principle of the cascade-delete well then
you should put the tag in the part of the relation which you want to be deleted automatically if you delete an instance of the other part. Assume the 'order-orderline' relation. One order can have many orderlines. When I remove the order I want the referencing orderlines to be removed.
So, I define something like this:
ejb-relationship-role : order
multiplicty: one
cmr-field: orderLines
ejb-relationship-role : orderLine
multiplicty: many
cmr-field: order
cascade-delete
If I delete the order, the referenced orderLines are deleted also, right ?
--------
Second, the spec also dictates that the other relation (which does not have the cascade-delete) should have a multiplicity of one. Why is this exactly ?
Assume that I switch the cascade-delete of the above example :
ejb-relationship-role : order
multiplicty: one
cmr-field: orderLines
cascade-delete
ejb-relationship-role : orderLine
multiplicty: many
cmr-field: order
When I remove an orderLine, the corresponding Order will also be removed. But according to the spec this should not be possible then ? Why ? The only problem I see is that there will be some orderLines left which point to a non existing order...
Thank you.