-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
HHH-18217 Properly handle empty value bindings for merge operations #10842
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
base: main
Are you sure you want to change the base?
Conversation
if ( cve.getKind() == UNIQUE ) { | ||
if ( valueBindings.isEmpty() ) { | ||
// Ignore primary key violation if the insert is composed of just the primary key | ||
return; | ||
} | ||
// assume it was the primary key constraint which was violated, | ||
// due to a new version of the row existing in the database | ||
throw new StaleStateException( mutationTarget.getRolePath(), cve ); | ||
} | ||
throw cve; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( cve.getKind() == UNIQUE ) { | |
if ( valueBindings.isEmpty() ) { | |
// Ignore primary key violation if the insert is composed of just the primary key | |
return; | |
} | |
// assume it was the primary key constraint which was violated, | |
// due to a new version of the row existing in the database | |
throw new StaleStateException( mutationTarget.getRolePath(), cve ); | |
} | |
throw cve; | |
if ( cve.getKind() == UNIQUE ) { | |
// Ignore primary key violation if the insert is composed of just the primary key | |
if ( !valueBindings.isEmpty() ) { | |
// assume it was the primary key constraint which was violated, | |
// due to a new version of the row existing in the database | |
throw new StaleStateException( mutationTarget.getRolePath(), cve ); | |
} | |
} | |
else { | |
throw cve; | |
} |
Thanks for working on this one, Christian. One doubt I have is: there are two different cases here:
Looking at these changes I can't clearly see where the difference between the two usages is manifest. It might be enough to just add a comment or something, but I would definitely like maintainers to have some warning about this subtlety. WDYT? |
[Please describe here what your change is about]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19725
https://hibernate.atlassian.net/browse/HHH-18217