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

Allow for the foreign dialects to benefit from UPSERT as well

Open
#2,304 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hey Team!

Thank you for introducing the UPSERT support, it is really helpful @christophstrobl. However, we're encountering a problem.

At Axelix (Spring Boot debugging and monitoring solution) we're writing our own dialect for SQLite, since this is the default database and Spring Data JDBC does not support it.

And we want to benefit from UPSERT too. We are not asking core Spring Data team to introduce support fro SQLite. Instead, we're asking to make the UPSERT functionality configurable for the end-users.

What I'm talking about is that now the code very strictly assumes via a switch check what dialects can be in the system. And Spring Data JDBC is explicitly designed to be extensible - users can implement JdbcDialect for example to adapt Spring Data JDBC for their own database.

But right now, if we want to introduce support for UPSERT for SQLite we just cannot do that - Spring Data in a hardcoded fashion assumes only certain databases to be able to UPSERT and not the others.

I have decided to reach out to you ASAP, since it is not yet released in GA. I can help with this if you do not mind, especially considering that we need this extensibility. 😄

Have a nice day!

CC: @mp911de

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.

Research direction

Start with spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/render/UpsertStatementRenderers.java, especially the switch check linked in the issue, and review the JdbcDialect extension point. Determine how UPSERT support can be made configurable for foreign dialects such as the custom SQLite dialect, with the result allowing those dialects to use UPSERT without hardcoded core support.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot, sqlite
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.