My error, similar to this, was when I tried to update a record in a table that had a compound primary key at the database but had only one in the model. Please check whether your model reflects that of the database.