Kotlin: How to insert a list of objects into Room? : <p>I am trying to define common <a href="https://en.wikipedia.org/wiki/Create,_read,_update_and_delete" rel="noreferrer">CRUD</a> methods in a base interface as shown here:</p>

<pre><code>interface BaseDao&lt;in I&gt; {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun create(obj: I)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun createAll(objects: List&lt;I&gt;)

    @Delete
    fun delete(obj: I)

}
</code></pre>

<p>The following <code>ProductDao</code> interface for <a href="https://developer.android.com/topic/libraries/architecture/room.html" rel="noreferrer">Room</a> inherits from the base interface:</p>

<pre><code>@Dao
interface ProductDao : BaseDao&lt;Product&gt; {

    // Specific methods

}
</code></pre>

<p>When I compile the definition for <code>fun createAll(objects: List&lt;I&gt;)</code> produces the following error:</p>

<blockquote>
  <p>Type of the parameter must be a class annotated with @Entity or a collection/array of it.</p>
</blockquote>
