-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
🐛 Bug에러 관련에러 관련
Description
🐞 버그/에러 개요
QR 생성 시 부모 계정에 자녀가 여러 명일 경우 단건 조회 실패로 인해 IncorrectResultSizeDataAccessException 발생
📝 상황 설명
📄 에러 대상
- AuthParentServiceImpl#createQR()
- AuthenticatedProvider#getAuthenticatedChild()
🕵🏻♀️ 에러 상황
- 부모 계정으로 로그인한 상태에서 자녀 등록이 되어 있을 경우, getAuthenticatedChild() 내부에서 단일 자녀를 조회하기 위해 getChildByParent()를 호출
- 하지만 부모가 자녀를 여러 명 보유하고 있어 parent_id=? 조건의 결과가 2건 이상 반환됨
- 이로 인해 JPA 단건 조회 메서드에서 IncorrectResultSizeDataAccessException 발생
- 최초 자녀 등록 시에는 에러 없음, 두 번째 자녀 등록 후 QR 생성 시부터 에러 발생
org.springframework.dao.IncorrectResultSizeDataAccessException:
Query did not return a unique result: 2 results were returned✅ Resolve TODO
- getChildByParent() → getChildrenByParent()로 변경하여 다건 조회 처리
- 자녀가 여러 명일 경우 예외를 발생시키거나, 명시적으로 선택하게 하는 구조로 리팩토링
- 프론트엔드와 연동해 childId를 명시적으로 전달하는 방식으로 전환 검토
- 인증 로직(AuthenticatedProvider) 전반적으로 다건 대응 로직 적용 여부 점검
📚 Remarks
Metadata
Metadata
Assignees
Labels
🐛 Bug에러 관련에러 관련