An insert operation fails if you do not set all of the non-default values. After an object has been inserted in the database, the record can be retrieved by a query operation. Many classes also support retrieval of individual records by unique key value. Typically, you cannot insert or update a record in the database until you change at least one field in the object. You use access methods to get and set the value of a field.
Most classes follow state-transition rules for accessing the database.
If you implement a class that access the database, you should follow the protocol for state transitions. Note that the NSProduct class does not implement the protocol at all. Generally, only methods that access the database on the server set a result code. A return value of 0 indicates that no error occurred. This manual lists only result codes set by the client, which is linked to your application.