I am developing an Android app using the Room persistence library. I have a User and a Car entity
@Entity(tableName = \"users\")
public class User {
@Primar
Columns returned by the query: id, name, id, userId, brand. Fields in com.foodtec.roomdemo.data.models.UserWithCar: user_id, user_name, car_id, car_userId, car_brand.
Error indicates that, columns returned by query is different from Pojo class. It should be the same. Alternatively you can map your Pojo variable to column name using @ColumnInfo
annotation.
For example,
@PrimaryKey
@NonNull
@ColumnInfo(name = "user_id")
private int id;
This way, id
will be mapped to user_id
.