```const val FORECAST_ID = 0 @Entity(tableName = ...
# room
m
Copy code
const val FORECAST_ID = 0

@Entity(tableName = "forecast")
data class ForecastEntry(
    @Ignore
    @Embedded(prefix = "current_")
    val current: Current = Current(),
    @Ignore
    @Embedded(prefix = "daily_")
    val daily: List<Daily> = listOf(),
    @Ignore
    @Embedded(prefix = "hourly_")
    val hourly: List<Hourly> = listOf(),
    @Ignore
    val lat: Double = 0.0,
    @Ignore
    val lon: Double = 0.0,
    @Ignore
    val timezone: String = "",
    @Ignore
    @SerializedName("timezone_offset")
    val timezoneOffset: Int = 0
) {
    @PrimaryKey(autoGenerate = false)
    var id: Int = FORECAST_ID

    constructor() : this(Current(), listOf(), listOf())
}
could anyone help me please?
h
Means you're not passing the ID that's why it shows a null pointer
m
@Harun thanks for answering, Where and how can I pass the id? I put the id field in
ForecastEntry
class.
h
You can make it to autogenerate by changing the field to
true
m
but I have only one record in my database all the time.
h
Do you have a sample json response for the network?