Hello!
I have a general question on how to delete object references.
Let's say I have two objects named Vehicle and Color. I have a unidirectional many-to-one relation from Vehicle to Color.
If I delete a Color object I understand that I have to set all references to this object to null. I'm a bit stuck with finding the best solution. I have three possibilities:
1) Check every Vehicle object for a matching Color reference and set to null
2) Make the relationship bidirectional, get Color object and do a vehicles.clear()
3) Enable "on delete set null" in the database for the relation
To me the second solution seems to be the best one. Can someone please give me some advice on that?
Thanks,
Fabian
|