I have a data class which is populated by retrofit. The server (API) has no id
field in it. So I created a val id
and assigned it some value say 69
. But once I receive the data, the value of id is not 69
, but 0
. Help please.
@Entity(tableName = "current_weather")
data class CurrentWeather(
@SerializedName("last_updated_epoch")
val lastUpdatedEpoch: Int,
// ... //
@SerializedName("gust_kph")
val gustKph: Float
) {
@PrimaryKey(autoGenerate = false)
var id: Int = 69
}
I even tried doing this:
data class CurrentWeather(
@PrimaryKey(autoGenerate = false)
val id: Int = 69,
// ... //
)