I added this entity and select dao query to my project in kotlin
This entity :
@NonNull @ColumnInfo(name = "namee") val name: String
@NonNull @ColumnInfo(name = "fav") val fav: String
and dao :
@Query("SELECT namee FROM my_table WHERE fav = 1")
fun loadFav(): List<Detail_Entity>
when I run my project I get this error :
Execution failed for task ':app:kaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
java.lang.reflect.InvocationTargetException (no error message)
When I remove "namee" and replace it with "" project work fine. But when I write query like above I get this error. SELECT query with "" works fine, but with other command like "SELECT column FROM ..." it will not work and I get this error. I'm so using "pojo class" and get the same error.
How can I use above SELECT query correctly?
The problem is in this row
fun loadFav(): List<Detail_Entity>
it must be changed to:
fun getfav(): LiveData<List<Detail_Entity_selectfav>>
You must use the sub class entity that have same column that you want to use.
Like:
class Detail_Entity_selectfav {
@NonNull
var name : String =""
@NonNull
var imageName : String =""
}