Deletion Policy, Serialization Function, and Object-to-Storage
The Deletion Policy and the Serialization and Object-to-Storage Functions
We'll cover the following
Deletion policy
We have to choose and implement one of two possible deletion policies that manage the corresponding object destruction dependency in the destroy
method of the property’s range class for any reference property. In our case, when deleting a publisher record, we have to choose between the following actions:
-
Delete all records of books published by the deleted publisher. This is known as existential dependency.
-
Drop the reference to the deleted publisher from all books by the deleted publisher. This is known as existential independence.
Assuming that books don’t existentially depend on their publishers, we choose the second option. The following code shows the Publisher.destroy
method which means that for all concerned book
objects, the property book.publisher
is cleared.
Get hands-on with 1400+ tech skills courses.