에러 발생
TooManyResultException: Expected one result(or not) to be returned by selectOne(), but found: 3
- 1개의 결과만 출력되어야 하는데 3개의 결과가 찾아지는 문제가 발생
- 보통은 list를 할텐데 list는 다른 쿼리로 뽑고 있어서 할 필요가 없었음
- 그래서 서브 쿼리를 select max() from 을 써서 결과가 잘 나오나 봄.
- ex ) select id, point, charge, email, phone_number from select( max(id), max(point), max(charge), max(email), max(phone_number) from user u join payment p on u.id = p.id)
- 결과는 성공!
'기록하는 중 > Spring Boot' 카테고리의 다른 글
[Spring] BeanCreationException: Error (0) | 2024.10.30 |
---|---|
[Spring Boot] Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. (0) | 2024.09.14 |
[Lombok] 어노테이션 (0) | 2024.01.28 |
[Spring] tomcat (0) | 2023.12.03 |
[@GeneratedValue] 기본키 생성 (0) | 2023.11.30 |