Sign in Go Pro

Storing Data in Android with Room

Creating the Data Access Object (DAO)

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



Room - Creating a Data Access Object (DAO)

In order to interact with the database, Room makes use of the Data Access Object pattern, otherwise known as a DAO. This lesson describes what a DAO is and how it can be defined in Room.

A DAO is an object which serves as a gateway between the database and the rest of the app. As such, all interactions that require reading from or writing to the database will go through a DAO object.

This lesson will walk you through defining a DAO for our Task entity, including use of the @Dao annotation and how the DAO should be registered with Room so that instances of the DAO can be created by the database.

Summary of content

  • What a Data Access Object (DAO) is
  • Defining a DAO for Tasks as an interface
  • @Dao annotation
  • How to register a DAO with the Room database
  • How to obtain an instance of your DAO from the database





There are no comments on this lesson, start the conversation below ...


Lessons in Storing Data in Android with Room