Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support multiple Update operations for the same column name #1596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
m3k0813 wants to merge 1 commit into spring-projects:main from m3k0813:GH-1525

Conversation

@m3k0813
Copy link
Contributor

@m3k0813 m3k0813 commented Aug 11, 2025

Fixes #1525

This PR enhances the Update class to support multiple operations on the same column, resolving the limitation of the previous Map-based implementation.

  • Changed the internal data structure of Update from Map<ColumnName, AssignmentOp> to List<AssignmentOp>. This allows multiple non-conflicting operations (e.g., setting different keys in a map) to coexist.

  • Introduced a conflict resolution mechanism to handle duplicate or conflicting operations. The new implementation follows a "last-wins" policy, as suggested in the issue discussion. For example, a set("name", "B") operation will replace a previous set("name", "A").

  • Added a comprehensive suite of unit tests to UpdateUnitTests to verify both the coexistence of non-conflicting operations and the "last-wins" replacement policy for various edge cases.


  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

Previously, the `Update` class used a `Map` to store its operations,
keyed by column name. This prevented multiple operations on the same
column, such as setting different keys in a map-type column, as later
operations would overwrite earlier ones.
This commit changes the internal data structure to a `List`, allowing
multiple operations to be recorded.
To align with the 'last-wins' semantics for conflicting operations
(e.g., setting the same column twice), a conflict resolution mechanism
has been added. New operations now replace existing, conflicting ones.
Adds comprehensive unit tests to verify both the coexistence of
non-conflicting operations and the replacement of conflicting ones.
Signed-off-by: Jeongjun Min <m3k0813@gmail.com>
Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot. This looks pretty decent. I'm going to polish this pull request for inclusion in the next release.

m3k0813 reacted with laugh emoji
@Override
public String toString() {
return StringUtils.collectionToDelimitedString(updateOperations.values(), ", ");
private static boolean equalsNullSafe(@Nullable Object a, @Nullable Object b) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method isn't needed, use ObjectUtils.nullSafeEquals(...) instead.

m3k0813 and injae-kim reacted with thumbs up emoji
Copy link
Contributor Author

m3k0813 commented Aug 11, 2025

Thanks for the review and the feedback, @mp911de! I'm glad you liked the contribution :)

@mp911de mp911de changed the title (削除) GH-1525: Support multiple operations per column in Update (削除ここまで) (追記) Support multiple Update operations for a column (追記ここまで) Aug 11, 2025
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 11, 2025
@mp911de mp911de added this to the 4.5.3 (202503) milestone Aug 11, 2025
@mp911de mp911de changed the title (削除) Support multiple Update operations for a column (削除ここまで) (追記) Support multiple Update operations for the same column name (追記ここまで) Aug 11, 2025
mp911de pushed a commit that referenced this pull request Aug 11, 2025
Previously, the `Update` class used a `Map` to store its operations,
keyed by column name. This prevented multiple operations on the same
column, such as setting different keys in a map-type column, as later
operations would overwrite earlier ones.
This commit changes the internal data structure to a `List`, allowing
multiple operations to be recorded.
To align with the 'last-wins' semantics for conflicting operations
(e.g., setting the same column twice), a conflict resolution mechanism
has been added. New operations now replace existing, conflicting ones.
Adds comprehensive unit tests to verify both the coexistence of
non-conflicting operations and the replacement of conflicting ones.
Signed-off-by: Jeongjun Min <m3k0813@gmail.com>
See #1525
Original pull request: #1596 
mp911de added a commit that referenced this pull request Aug 11, 2025
Reformat code. Rename conflicts method to overrides to indicate actual semantics and use type hierarchy for checks. Replace spaces with tab indents.
Extend test.
See #1525
Original pull request: #1596 
mp911de pushed a commit that referenced this pull request Aug 11, 2025
Previously, the `Update` class used a `Map` to store its operations,
keyed by column name. This prevented multiple operations on the same
column, such as setting different keys in a map-type column, as later
operations would overwrite earlier ones.
This commit changes the internal data structure to a `List`, allowing
multiple operations to be recorded.
To align with the 'last-wins' semantics for conflicting operations
(e.g., setting the same column twice), a conflict resolution mechanism
has been added. New operations now replace existing, conflicting ones.
Adds comprehensive unit tests to verify both the coexistence of
non-conflicting operations and the replacement of conflicting ones.
Signed-off-by: Jeongjun Min <m3k0813@gmail.com>
See #1525
Original pull request: #1596 
mp911de added a commit that referenced this pull request Aug 11, 2025
Reformat code. Rename conflicts method to overrides to indicate actual semantics and use type hierarchy for checks. Replace spaces with tab indents.
Extend test.
See #1525
Original pull request: #1596 
Copy link
Member

mp911de commented Aug 11, 2025

Thank you for your contribution. That's merged, polished, and backported now.

m3k0813 reacted with heart emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mp911de mp911de mp911de approved these changes

Assignees

No one assigned

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple Update operations for the same column

AltStyle によって変換されたページ (->オリジナル) /