Skip to content

Improve entity fetching from db #16726

Closed
@franticticktick

Description

@franticticktick

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 method saveAuthorizedClient
  • JdbcUserCredentialRepository method save

If possible, tests should be left as is.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions