Collections Update Depth

When you work with collections you should pay a special attention to your update depth setting, as the performance impact of this setting increases with the number of objects in the collection.

For example let’s consider a class like this:

Java: 

class ListObject {

           List <DataObject> data;

}

Let’s assume that ListObject has a data list of 1000 DataObjects.

Update depth = 1

data field object (List) will be updated if ListObject is saved.

Update depth = 2

data object (List) and all 1000 DataObjects in the list will be updated if ListObject is saved.

It is easy to see that after a certain update depth value all the list objects are getting updated, which produces a serious performance penalty. The following examples show how to avoid the performance drop and still get the expected results.