spring-projects / spring-projects/spring-data-relational
'upsert' syntax and real 'batch' syntax support
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 827
- Forks
- 394
- PR merge metrics
- No merged PRs in 30d
Description
Now when I want to insert multiple records at once, I must use the saveAll method. And the saveAll method uses the save method↓
// in class `SimpleR2dbcRepository`
public <S extends T> Mono<S> save(S objectToSave) {
Assert.notNull(objectToSave, "Object to save must not be null");
if (this.entity.isNew(objectToSave)) {
return this.entityOperations.insert(objectToSave);
}
return this.entityOperations.update(objectToSave);
}
it wiil check if each record is new.
I'd like to know if there is any support for 'upsert' syntax or real batch insert syntax (insert into ... values (...), (...);)
Thanks in advance :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SimpleR2dbcRepository.save and saveAll, then trace the entity operations used for inserts and updates. Check whether the existing R2DBC APIs expose upsert or true multi-row insert behavior; done means the supported behavior and any required API scope are established for both requested forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, sql
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100