My data class looks like this
@Entity(tableName = "items")
data class Item(
@ColumnInfo(name = "name") var name: String = "",
@ColumnInfo(name = "room") var room: String = "",
@ColumnInfo(name = "quantity") var quantity: String = "",
@ColumnInfo(name = "description") var description: String = "",
@PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "id") var id: Long = 0
)
Room uses SQLite and SQLite supports NOT NULL columns in its database. I tried annotating columns with @NonNull but it has no effect.
Is there a way to make columns in Room Database not nullable?
For Java you should annotate with @android.support.annotation.NonNull
DO NOT CONFUSE WITH @io.reactivex.annotations.NonNull