spring-projects / spring-projects/spring-data-relational

Only delete those referenced entities that are no longer present in an aggregate. Use an upsert for all others [DATAJDBC-224]

Open
#450 4 comments 1 reaction 1 assignee View on GitHub

@schauder is already working on this.

Since Dec 31, 2020.

in: jdbc type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

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.

  1. Support for upsert/merge statements varies among databases. We might need a fallback.
  2. 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.
  3. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.