Realm allows you to create relationships between your model objects. Learn how to establish one-to-one, many-to-one and one-to-many relationships in this video.
- [Instructor] Let's look at how you can establish…relationships between your Realm models.…We're going to start with a one to one relationship.…Let's suppose you have two entities,…a user and an email.…They both have the following fields.…You want each user to have a corresponding email record,…like so.…What would you have to do?…Well, for the Email class, it would be modeled…just as we've seen before.…It would extend the RealmObject base class,…and then include the desired fields.…
For the User object, we would do the same,…extending RealmObject, except for notice…that the email address field is of type Email.…That's all we need in order…to have Realm link these objects for us,…which is pretty sweet.…Now although we've modeled this…as a one to one relationship,…technically there is nothing that inherently prevents this…from being a many to many relationship.…Namely, Realm would not prevent the scenario…where two users reference the same Email object.…
So both Joe and Gladys…could potentially reference Joe's email record.…
To begin, Annyce Davis reviews using the de facto data persistence solution available on Android: SQLite. She takes you through basic SQLite concepts—such as how to create a database wrapper and insert data into a table—as well as a few more advanced topics. Next, she covers working with Cupboard, an open-source project dedicated to simplifying your SQLite interactions. To wrap up, she dives into working with Realm, an object database solution designed with mobile devices in mind. Throughout the course, Annyce discusses establishing relationships between database tables, creating and running queries, as well as performing data migrations.
- Overview of SQLite
- Defining a database table's schema
- Exploring SQLite create table syntax
- Executing create table statements
- Inserting data with a foreign key relation
- Inspecting the database using a terminal
- Updating and deleting records
- Working with Cupboard
- Working with Realm
Skill Level Intermediate
Android App Development: Unit Testingwith James P White2h 58m Intermediate
Learning Firebase Cloud Messaging for Androidwith Joe Marini52m 49s Intermediate
1. SQLite Basics
2. SQLite Beyond the Basics
3. Working with Cupboard
4. Realm Basics
5. Realm Beyond the Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.