| Collection changes are handled by ORM CollectionUpdateAction as three calls to CollectionPersister.deleteRows, CollectionPersister.updateRows, CollectionPersister.insertRows. And this regardless whether the collection has to lead to row deletion, udpate or inserts. Because *Rows are implemented as
AssociationPersister p = getAssociationPersister(...);
...
p.flushToDatastore();
We literally do three AssociationPersister flushes per collection changes. This problem will be mitigated by operation grouping and association tuple caching (Guillaume Smet). But should we make it cleaner at the higher level ? I would prefer that but it might not be practical. CollectionUpdateAction is pure ORM and OGMCollectionPersister is ours to change. since the action does the three successive calls, we can't really cleanly solve it except by not calling ap.flushToDatastore in insertRows. It feels asymmetrical and unclean as well as error prone if in the future calls to *Rows are dissociated. This is a reference to trigger a quick thinking and make a decision. |