Posts

Showing posts with the label database

Android Architecture Components : Room Persistence Library

Image
Room: a SQLite object mapping library After many years and using countless 3rd party DAO libraries I am happy to finally introduce official Android solution to working with SQLite databases and it is called Room Persistence Library. Before we begin you can find code from this tutorial here . SQL Review Data is stored in tables Table's rows contain entities Table's columns contain entity's fields Rows can have id's (primary keys) and id's must be unique You can create relationships between rows in different tables by referring to other row's id (foreign key) Index primary key columns for performance Use SQL queries to find sort and filter the data from tables What is Room? Room is a library that uses annotations in your Java data models and your data access objects (DAO's) to generate database schema (table definitions) and SQLite queries. So you don't have to write all the SQLite queries from scratch and have logic for storing and r...