I have a User
class with a field id
, so I wanted to run the following query with Room:
@Query("SELECT * FROM ticket where user_id = :user.id")
LiveData<Ticket> loadFromUser(User user);
But I am getting error marks on Android Studio on user.id
and all examples I find online only use the direct parameter of the @Query
method, usually a String
or an int
.
Is it possible to use an object's field in a Room @Query
? If positive, so what's the proper way of referencing it.