Sign in Go Pro

Storing Data in Android with Room

One to Many Relationships

11/13/2018

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

Overview

In this lesson, we'll describe what a one to many relationship is, and how we can use Room to model this relationship type.

We'll model our data so that one User can have multiple Tasks assigned to them. And we'll learn how to write a query which brings back an entity as well as all of its related entities.

Summary of Content:

  • What a one to many relationship is
  • Alternative ways of modelling users and tasks
  • Using an SQL JOIN query to obtain a task and its assigned user
  • Creating a wrapper class which contains both a Task and a User
  • @Embedded annotation
  • How to handle the scenario when multiple fields have a the same column name - Multiple fields have the same columnName
  • Adding a custom prefix using prefix property of @Embedded annotation

Links:

Instructor

Links

Comments

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

>
You need to go PRO to post comments.

Lessons in Storing Data in Android with Room