title: How to make primary key as autoincrement for Room Persistence lib
body: <p>I am creating an Entity (<a href="https://developer.android.com/topic/libraries/architecture/room" rel="noreferrer">Room Persistence Library</a>) class Food, where I want to make <code>foodId</code> as autoincrement.</p>
  <pre><code>@Entity
  class Food(var foodName: String, var foodDesc: String, var protein: Double, var carbs: Double, var fat: Double)
  {
      @PrimaryKey
      var foodId: Int = 0
      var calories: Double = 0.toDouble()
  }
  </code></pre>
  <p>How can I set <code>foodId</code> an autoincrement field?</p>