When updating an aggregate we should not delete all referenced entities in the database.
Instead we should only delete those no longer present in the database and use an upsert/merge on the others.
There are a couple of things to watch out for.
- Support for upsert/merge statements varies among databases. We might need a fallback.
- entities might have composite ids, in which case a simple
in ( ... ) might not work. We need to figure out how we might construct an equivalent statement for the supported databases.
- Databases and drivers will have various limits for length of SQL statements. We should at least know about these and take them into consideration.
This is a subtask of #437
Jens Schauder opened this as DATAJDBC-224