🌳 에러 코드
java.sql.SQLException
"could not execute query; SQL [SELECT d.hospitalName, d.hospitalAddress, d.mapx, d.mapy, d.category, d.hospitalPhoneNumber, d.hospitalIntroduce, d.hospitalProfileURL FROM doctor d WHERE d.category = ?]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query",
🌳 해결 방법
🌾 해결 방법 : Doctor 엔티티를 사용하지 않고 interface 반환 타입을 만들어서 해결.
https://www.baeldung.com/jpa-queries-custom-result-with-aggregation-functions
Before
After
public interface HospitalInterface {
String getHospiatalName();
String getHospitalAddress();
String getMapx();
String getMapy();
String getCategory();
Integer getHospitalPhoneNumber();
String getHospitalIntroduce();
}
'코딩 에러 및 질문' 카테고리의 다른 글
Cannot drop column : needed in a foreign key constraint (0) | 2023.09.02 |
---|---|
Date 객체 이쁘게 정리 (0) | 2023.08.31 |
java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException (0) | 2023.08.24 |
io.jsonwebtoken.MalformedJwtException: Unable to read JSON value: ����&�r#�$�3#Sb' (0) | 2023.08.21 |
java.lang.IllegalStateException (0) | 2023.08.21 |