-
Notifications
You must be signed in to change notification settings - Fork 6k
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 JdbcUserCredentialRepository Save #16621
base: main
Are you sure you want to change the base?
Conversation
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.
Hi, @franticticktick, I've left some feedback inline.
@@ -133,6 +152,21 @@ public void delete(Bytes credentialId) { | |||
@Override | |||
public void save(CredentialRecord record) { | |||
Assert.notNull(record, "record cannot be null"); | |||
boolean existsRecord = null != this.findByCredentialId(record.getCredentialId()); |
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.
I think the following logic achieves the same outcome:
int rows = updateCredentialRecord(record); // change to return the number of rows affected
if (rows == 0) {
insertCredentialRecord(record);
}
This would complete more quickly and also be less load on the database.
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.
Good solution. I think we can do this polish in other places with similar logic.
Also, will you please rebase to |
Closes spring-projectsgh-16620 Signed-off-by: Max Batischev <[email protected]>
Hi @jzheaux . Thanks for your feedback. This component was introduced in current version, so it is not in |
2f41603
to
af56c22
Compare
Closes gh-16620