title: Room error - how to deal with?
body: <p>I use Android Room library. I have entity Products:</p>
  
  <pre><code>@Entity(tableName = "products", foreignKeys = @ForeignKey(
          entity = Category.class,
          parentColumns = "code",
          childColumns = "category_id"))
  public class Product {
  
      @PrimaryKey(autoGenerate = true)
      private Long id;
  
      @ColumnInfo(name = "name")
      private String name;
  
      @ColumnInfo(name = "description")
      private String description;
  
      @ColumnInfo(name = "category_id")
      private String categoryId;
  </code></pre>
  
  <p>and second entity. </p>
  
  <pre><code>@Entity(tableName = "categories")
  public class Category {
  
      @PrimaryKey
      @NonNull
      private String code;
  
      @ColumnInfo(name = "name")
      private String name;
  
      @Ignore
      private List&lt;Product&gt; products;
  </code></pre>
  
  <p>When I try insert list of products:</p>
  
  <pre><code>new AsyncTask&lt;Void, Void, Void&gt;() {
              @Override
              protected Void doInBackground(Void... voids) {
                  MyApplication.get().getDB().productDao().insertAll(productList);
                  return null;
              }
          }.execute();
  </code></pre>
  
  <p>I get error when try insert products to DB. </p>
  
  <pre><code>Caused by: android.database.sqlite.SQLiteConstraintException: foreign key constraint failed (code 19)
  </code></pre>
  
  <p>How can I fix it?</p>