How to handle wholly owned nested object persistence with Objectbox in flutter app?

370 views Asked by At

I have a general utilization question on how to set up Objectbox entities for wholly owned nested objects

My app has a central data entity 'Class1'. The 'Class1' entity includes an array of 'Class2' instances. The 'Class2' entity includes an array of 'Class3' instances. Both the 'Class2' and 'Class3' entities are fully owned by a single 'Class1' entity (i.e. they are never used or linked to anything else)

What's the best strategy for mapping wholly owned nested objects in Objectbox?

1

There are 1 answers

0
Uwe - ObjectBox On

If I understand correctly, this can be done using relations in ObjectBox.

E.g. Class1 would have a ToMany relation property, Class2 a ToMany relation property.

https://docs.objectbox.io/relations#to-many-relations