현재 프로젝트에서 최대 절전 모드 JPA를 지속성 라이브러리로 사용하고 있습니다. 그리고 쿼리에 매개 변수를 설정할 때 이상한 오류가 발생합니다.JPQL 매개 변수 유형 오류
I는 다음 가지고
List<Location> loca = JPA.em().createQuery(
"SELECT location FROM Location as location"
+ " where "
+ "(6371 * acos(cos(PI()/180 * :platitude) * cos(PI()/180 *location.latitude ) * "
+ "cos(PI()/180 *location.longitude - PI()/180 *:plongitude) + sin(PI()/180 *:platitude) * "
+ "sin(PI()/180 *location.latitude))) < :radius")
.setParameter("radius", 10000.0)
.setParameter("platitude", new Double(latitude))
.setParameter("plongitude", new Double(longitude))
.getResultList();
결과 오류 :
[IllegalArgumentException가 파라메타 값 [43.239474] 일치하지 않은 유형 [java.lang.Integer의]
그러나이 값은 정밀도의 손실로 인해 정수로 변환 될 수 없습니다.
제안 사항?
어떤 데이터베이스를 사용하고 있습니까? 데이터베이스 소수점의 필드 유형이 좋아? 설정하는 엔터티 특성이 이중으로 설정되어 있습니까? – rbento
postgresql을 사용하고 있습니다. 예 엔티티 속성은 double이고 데이터베이스 필드는 "double precision"입니다. –
180을 180.0으로 교체하려고 시도 했습니까? –