728x90
에러내용
query did not return a unique result:4
에러원인
Repository 에서 조회할 때 중복된 값이 발생하여 나타난 에러.
아이디는 unique 값으로 중복될 수 없지만, 비밀번호는 중복이 가능하기 때문에 발생한 에러였다.
memberRepository.findByLoginId(noSocialLoginRequest.getLoginId()).orElseThrow(
()-> new IllegalArgumentException("아이디를 확인해주세요.")
);
memberRepository.findByPassword(noSocialLoginRequest.getPassword()).orElseThrow(
()-> new IllegalArgumentException("비밀번호를 확인해주세요.")
);
에러조치
아이디와 비밀번호를 and 조건으로 찾아 올 수 있도록 생성
Member member = memberRepository.findByLoginIdAndPassword(noSocialLoginRequest.getLoginId(), noSocialLoginRequest.getPassword())
.orElseThrow(() -> new BusinessException(ErrorCode.CHECK_LOGINID_OR_PASSWORD));
728x90
'Error' 카테고리의 다른 글
Illegal DefaultValue null for parameter type integer (0) | 2022.12.21 |
---|---|
AWS S3 access denied Error (0) | 2022.12.20 |
javax/xml/bind/DatatypeConverter (0) | 2022.12.06 |
'script' must not be null or empty (0) | 2022.11.29 |
Referential integrity constraint violation (0) | 2022.11.26 |
댓글