How do you handle CMR with non-nullable fields and not using cascade-delete?
I have three beans A, B and C. A is 1:1 with B and 1:many with C. The foreign key in A that represents B is non-nullable (obviously, no fields exists in A that represents C). Now I create a record in A and C, then delete A (the record in C points to the record in A).
For the A-C relationship, I use batch-cascade-delete. So from the logs, it says "Scheduled for batch-cascade-delete". So there is no problem there.
For the A-B relationship, the container is setting the relevent field to NULL - this causes a foreign key violation error.
Is there any way to handle this generally? Can I postpone the NULL setting action (preferably never to be done, as the entity is about to disappear)? Or do I have to abandon CMR (I cannot change the database - besides, it makes no sense to)?
Thanks,
Ian
Is there any definitive answer on this? Does CMR actually work in a practical way with pre-defined databases? Or is this just a shortcoming in JBoss?