Entity ID In Drupal 8.3

Hi,

I have created the custom entity. It’s working on Drupal 8.2, but after upgrading to 8.3 i get the following error when trying to create new entity.

DrupalCoreEntityEntityStorageException: SQLSTATE[HY000]: General error: 1364 Field 'code' doesn't have a default value: INSERT INTO {master} (uuid, name) .....

Here is some snippet of my code. This is the part of annotation I used.

.....
entity_keys = {
 "id" = "code",
 "label" = "name",
 "uuid" = "uuid",
},
.....

And this is part of the code for creating the field.

.....
$fields['code'] = BaseFieldDefinition::create('string')
  ->setLabel(t('Code'))
  ->setDescription(t('The code for this data.'))
  ->setRequired(TRUE)
  ->setSettings([
    'default_value' => '',
    'max_length' => 50,
  ])
  ->setDisplayOptions('view', [
    'label' => 'above',
    'type' => 'string',
    'weight' => 1,
  ])
  ->setDisplayOptions('form', [
    'type' => 'string_textfield',
    'weight' => 1,
  ])
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);
.....

It seems like my code field is omitted from the INSERT statement. I think Drupal assume it as auto-increment. But, it’s not an auto-increment field and I need to fill that field manually from the textfield.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed