I am using Objectbox and have setup several Entities. My entities contain references to other entities. For example:
@Entity
class EntityA {
@Id
var id: Long = 0
lateinit var bEntities: ToMany<EntityB>
fun addB(b: EntityB) {
bEntities.add(b)
b.entityA.target = this
}
}
@Entity
class EntityB {
@Id
var id: Long = 0
lateinit var entityA: ToOne<EntityA>
}
I am able to create EntityA and link it to all my EntityB. Then I am able to store EntityA and recover all of it's information along with the EntityB objects linked to it.
My question is: If I want to update one of the EntityB that is linked to EntityA would I have to get a Box for EntityB and put the updated object in that box? Or should I be able to update the EntityB object by changing it's values and then updating the Box for EntityA which contains the EntityB object?