Reputation: 11
I am building an android app.In that app we need to implement select query with where clause ,using kotlin.
@Query(value = "Select * from AddEntity where type= +'Bird'")
fun getAllbirdModule() : List<AddEntity>
we are try this code but it is not working.
Upvotes: 1
Views: 615
Reputation: 1521
Try to pass type in function rather than using hardcode value in Query like this
@Query(value = "SELECT * from AddEntity WHERE type = :type")
fun getAllbirdModule(type: String) : List<AddEntity>
or remove + sign
@Query(value = "Select * from AddEntity where type='Bird'")
fun getAllbirdModule() : List<AddEntity>
Upvotes: 3
Reputation: 57063
Try :-
@Query(value = "Select * from AddEntity where type='Bird'")
fun getAllbirdModule() : List<AddEntity>
Upvotes: 0