Closed
Description
It is necessary to improve the way of fetching entities from the database in accordance with the pattern suggested by @jzheaux , using the example of JdbcPublicKeyCredentialUserEntityRepository
:
if (existsUserEntity) {
updateUserEntity(userEntity);
}
else {
try {
insertUserEntity(userEntity);
}
catch (DuplicateKeyException ex) {
updateUserEntity(userEntity);
}
}
Thic code can be replaced by:
int rows = updateUserEntity(userEntity);
if (rows == 0) {
insertUserEntity(userEntity);
}
This polish can be done in the following components:
JdbcOAuth2AuthorizedClientService
methodsaveAuthorizedClient
JdbcUserCredentialRepository
methodsave
If possible, tests should be left as is.