64.2 Key Elements of Room Database Persistence
Before going into greater detail later in the chapter, it is first worth summarizing the key elements involved in working with SQLite databases using the Room persistence library:
64.2.1 Repository
As previously discussed, the repository module contains all of the code necessary for directly handling all data sources used by the app. This avoids the need for the UI controller and ViewModel to contain code that directly accesses sources such as databases or web services.
64.2.2 Room Database
The room database object provides the interface to the underlying SQLite database. It also provides the repository with access to the Data Access Object (DAO). An app should only have one room database instance which may then be used to access multiple database tables.
64.2.3 Data Access Object (DAO)
The DAO contains the SQL statements required by the repository to insert, retrieve and delete data within the SQLite database. These...