Deleting Entity Objects
Prev | Chapter 5. Saving and Retrieving Objects | Next

## Deleting Entity Objects

The simplest way to remove an object from your entity store is to delete it by its primary index. For example, using the `SimpleDA` class that we created earlier in this document (see SimpleDA.class), you can delete the `SimpleEntityClass` object with a primary key of `keyone` as follows:

    sda.pIdx.delete("keyone");

You can also delete objects by their secondary keys. When you do this, all objects related to the secondary key are deleted, unless the key is a foreign object.

For example, the following deletes all `SimpleEntityClass` with a secondary key of `skeyone`:

    sda.sIdx.delete("skeyone");

Finally, if you are indexing by foreign key, then the results of deleting the key is determined by the foreign key constraint that you have set for the index. See Foreign Key Constraints for more information.

Prev | Up | Next
Join Cursors | Home | Replacing Entity Objects