Room is a library used for local caching that makes use of annotations for commonly used persistence code.
Room functionality is composed of:
AppDatabase class extending RoomDatabase(and @Database annotation, which much have an array assigned to entities).
DAOs (data access objects) for providing methods that interact with the database.
Data entities for each of the database’s tables.
Classes with the @Entity annotation will by default have database columns corresponding to their fields.
@PrimaryKey is used to annotate the field used for unique identification within that table. (can set autoGenerate property for ID values). A pair/set of columns may be used instead, assigned to primaryKeys within the @Entity parenthetical code.
Write an annotated @Query method to return a mapped set of objects. This approach requires more and more complicated SQL queries.
Write a class for data access with the @Dao annotation which gets relevant data from the DB.