Data objects stored in Backendless may have related objects through one-to-one or one-to-many collections. When objects are retrieved on the client side, these relations are materialized as collections of data in object’s fields or properties. Consider the following data object:The Person table has the addresses column which is a one-to-many collection with the Address table.The Person table schema is:

The related Address objects are shown below:

At the code level, there is
Person class defined as:

Java

1

2

3

4

5

6

7

8

9

10

11

12

packagecom.mbaas.sample;

importjava.util.Date;

importjava.util.List;

publicclassPerson

{

publicintage;

publicStringname;

publicDate birthdate;

publicList<Address>addresses;

}

And the related
Address class is defined as:

Java

1

2

3

4

5

6

7

packagecom.mbaas.sample;

publicclassAddress

{

publicStringstreet;

publicStringcity;

}

The code below loads the Person object with the related Address objects. It prints out the number of Address objects, deletes one from the collection and saves the Person object back. Once it is saved and the updated instance is returned, the code prints out the number of related addresses to confirm one was indeed deleted:

It is important to note that Backendless supports any kind of relation update. Your code could add new related objects, remove some (as shown above), change data inside of the related objects, etc. All of these changes will be persisted when the parent (Person) object is saved.