Skip to content
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

Fix bug in JDBC SaveMode.ON_GET_ATTRIBUTE #2040

Conversation

felixscheinost
Copy link
Contributor

This fixes a bug in the JDBC implementation of SaveMode.ON_GET_ATTRIBUTE.

I included a testcase that triggers the bug.

The steps to reproduce the bug are:

  • Use SaveMode.ON_GET_ATTRIBUTE
  • Have an existing session
  • Do a setAttribute of a new attribute
  • Immediately after, before save, do a getAttribute of the same attribute
    • ON_GET_ATTRIBUTE causes this attribute to be set to DeltaValue.UPDATED
    • FIX: Set to UPDATED iff not already set to ADDED
  • Later save tries to just UPDATE the new value which fails silently

@pivotal-cla
Copy link

@felixscheinost Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@felixscheinost Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 3, 2022
@eleftherias eleftherias self-assigned this Mar 9, 2022
@eleftherias eleftherias added in: jdbc type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 10, 2022
Copy link
Contributor

@eleftherias eleftherias left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @felixscheinost!

I've left a comment below.

Please run ./gradlew format once you've added the changes and squash the commits into a single one.

@felixscheinost felixscheinost force-pushed the fix-jdbc-SaveMode-ON_GET_ATTRIBUTE-bug branch from 2a43b81 to 8668164 Compare March 18, 2022 16:34
@felixscheinost felixscheinost force-pushed the fix-jdbc-SaveMode-ON_GET_ATTRIBUTE-bug branch from 8668164 to 3eaa127 Compare April 7, 2022 15:22
@eleftherias eleftherias added this to the 2.7.0-RC1 milestone Apr 8, 2022
@eleftherias eleftherias merged commit 8800fb9 into spring-projects:main Apr 8, 2022
eleftherias pushed a commit that referenced this pull request Apr 8, 2022
@eleftherias
Copy link
Contributor

eleftherias commented Apr 8, 2022

Thanks for the PR @felixscheinost!
This is now merged into the 2.7.x branch and the main branch.
I will also backport it to 2.6.x and 2.5.x.

@eleftherias eleftherias added the status: backported An issue that has been backported to maintenance branches label Apr 8, 2022
@felixscheinost felixscheinost deleted the fix-jdbc-SaveMode-ON_GET_ATTRIBUTE-bug branch April 9, 2022 16:22
@felixscheinost
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: jdbc status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants