This one had me stumped for a while so I thought it might be useful to share it with the class…

When you create a model in Magento that reads and writes data to a database table, by default, Magento expects the primary key of the table to be an auto_increment field named id.

If you want to use a primary key that is not an auto_increment field then you need to set the _isPkAutoIncrement flag on your model’s resource to false.

For example: