I have a select query in Room DB that collect data from multiple tables, so I created a custom data class suitable for those returned data, now, I want to add an extra attribute to the class without returning it from the query, when I added the
extraAtt
I got a compiler error, how do I deal with that?
Copy code
data class MyClass(val a: Int, val b: int, val extraAtt: Int)
------------
@Query("select a, b from tableName")
fun getData(): List<MyClass>
@ignore
doesn't help me
a
Ameen Essa
11/21/2022, 12:42 PM
Did you update the Database Version with Migration Option!
a
AmrJyniat
11/21/2022, 1:33 PM
No. I figured out the solution, I should annotate the class with @JvmOverloads and give the extraAtt a default value!
✅ 1
z
Zaki Shaikh
11/21/2022, 2:06 PM
I think you should call fallBackToDestructibeMigration on creating retrofit instance this may help.