I'm wanting my Dao to populate @Ignore columns in my Entity class. For example:
Entity
@Entity(tableName = "example")
data class Example(
@PrimaryKey
val id: Long,
val value: Int
) {
@Ignore
var nextId: Long = 0L
}
Dao
@Dao
interface ExampleDao {
@Query(value = "SELECT *, (id + 1) AS nextId FROM example")
fun getAllExamples(): List<Example>
}
However, when the application gets built, the following warning gets produced:
The query returns some columns [nextId] which are not used by com.example.app.Example and it doesn't populate nextId.
Is it possible to include @Ignore columns in a @Query (if so, how)? If not, what are some strategies that can be employed to populate columns that are not present in my tables into my Entity class.
Note: I'm fully aware with the example provided that I can simply do something like:
@Ignore
val nextId: Long = id + 1
But is not the point of the question I am asking.