How storage works?

#1

I have one Class Car that contains a ArrayList of Wheels.

I have already one Car with 4 Wheels attached stored in the DB.

If I update my Car adding a new Wheel object is all the Car updated? Or only changed part is updated?

By other words, If I have one complex data model and only one part is changed, the Object DB stored the all complex data model or only the changed part?

Thanks

#2

If you update a complex object model - only modified entity objects are stored by ObjectDB again.

When an element is added to a collection - only the owner side requires update.

Therefore, if the collection is annotated as inverse (mapped by) the entity object in which the collection is defined (Car) is not stored in the database when a new entity is added to the collection, only that entity that is added is stored (Wheel).

If the collection is not defined as inverse (mapped by) the entity object in which the collection is defined has to be stored.

Using direct collections (not inverse / mapped by) is usually more efficient in ObjectDB, at least in retrieval. However, if the collection is very large and updated frequently there is a performance advantage in defining it as inverse / mapped by.

ObjectDB Support

Reply