How do you indicate that a class represents an entity to store in a room database?

How do you indicate that a class represents an entity to store in a room database?
Answer
Entities
  1. All the classes that represent an entity of the database have to be annotated with @Entity .
  2. With the annotation @PrimaryKey(autoGenerate = true) we are indicating that id is the primary key of the entity and should be autoGenerate by the database engine.
3 авг. 2018 г.
 

Tìm kiếm

Back
Top