Previously we showed how to declare relationships between tables. Once a relationship is in place, specific objects stored in the tables may be linked with each other. This linkage may be expressed through the code, where the instances of classes reference each other through the composition method. However, there are scenarios where these relationships may need to be created directly in the storage system. Backendless Console is the development tool that lets you manage it using a graphical interface.
The types of relationships you can build by hand can be either one-to-one or one-to-many. As a result of establishing a relationship between any two or more objects, you can retrieve the related objects using the API. For instance, in the example below a restaurant object will have a relationship with one or more location. When the restaurant object is retrieved via an API call, all the related locations can be retrieved as well.
The example below is based on the tables and the relationship between them reviewed in this post. Before you create a relationship between any two objects, you need to make sure the objects are created first (this may seem like an obvious thing, but if you are just getting started with Backendless, it can get lost in the shuffle), you see read about how to add objects using Backendless Console.
In my example, I have two tables: Restaurant and Location. You can see the schema of these tables below: