h1. Background
Currently, there are separate methods for insert/updating tuples and association(s) managed by the entity represented by a given tuple. This makes it tough for dialects to write out tuple change and the association change in one roundtrip to the datastore also if this would make very much sense on stores mostly of the document family where an entire object tree is stored within one document.
h1. Proposal
Replace the following methods on {{GridDialect}}:
* {{ insertOrUpdateTuple() }} * {{ insertOrUpdateAssociation() }} * {{ removeAssociation() }}
With a combined method which takes all the info for upsert-ing an entity and all the association(s) it embeds (either element collections or associations stored in-entity):
* {{ upsertTupleWithAssociations() }}
It would receive:
* All the info on the embedding tuple * All the info on the embedded associations (directly or nested within embeddeables)
h1. Implementation proposal
This would be driven by the existing batching engine (see attached image). The batch delegator would always be enabled, also if batching is not implemented by a given dialect. Upon batch execution, it would group all operations by ids of the embedding entities and either invoke {{upsertTupleWithAssociations}} one-by-one, or it would execute this as a batch if supported (so we'd need a {{UpsertTupleWithAssociationsOperation}}, too). |
|