Nguyễn Thu Trang
New member
How do you indicate that a class represents an entity to store in a room database?
Answer
Entities
Answer
Entities
- All the classes that represent an entity of the database have to be annotated with @Entity .
- 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.