Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Android Room Database Create Entity Object without Id

Don't place the id in the constructor:

@Entity(tableName = "student")
data class Student(
    val name: String,
    val age: Int,
    val gpa: Double,
    val isSingle: Boolean
) {
    @PrimaryKey(autoGenerate = true)
    var id: Long? = null
}

Tags:

Android

Android Room

Kotlin

Android Database

Related

How to Separate IObservable and IObserver How to remove and ID from a string Is it possible to create a self-rendering Rmarkdown document? Convert X and Y arrays into a frequencies grid Why does enabling undefined behaviour sanitization interfere with optimizations? Exception thrown in build by image_picker (Python: discord.py) ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly How can I fix the web-dev-server execution error? Efficient way of filtering by datetime in groupby AndroidStudio crash on macOS Big Sur beta Why is this wrapped function call faster than a regular function? How does one join string-type array-items, each with a comma character, except for the last item which has to be joined by "and"?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy