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

How to achieve @DynamicInsert effect in Spring Data JDBC?

Open
#1,522 5 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

Hello,

I would like to open an issue to inquire about the implementation of the "@DynamicInsert" effect in Spring Data JDBC.

@DynamicInsert is an annotation commonly used in Hibernate, which allows for selective insertion of entity fields based on their values. In other words, only non-null fields are inserted into the database during an "INSERT" operation, while null fields are excluded. I'm wondering if there is a similar functionality available in Spring Data JDBC.

I have gone through the Spring Data JDBC documentation but couldn't find any specific annotation or configuration option that replicates the behavior of "@DynamicInsert" in Hibernate. Could you kindly provide some guidance on how to achieve a similar effect in Spring Data JDBC? Are there any built-in mechanisms or recommended approaches to accomplish this selective insertion behavior?

Any insights, suggestions, or code examples you can provide would be highly appreciated. Thank you for your time and assistance.

Best regards!

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

No source file, test, or entry point is named. Start by reviewing the Spring Data JDBC documentation and the existing insert behavior, then determine whether the requested selective handling of null fields has a defined implementation scope; done should be a decided, documented approach or a clearly scoped feature.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.