@NamedNativeQuery(
name = "F_getSurveyListDept.surveyListDeptAllFind",
query = " SELECT l.loca_name name "
+ " , l.loca_id id "
+ " , COUNT(b.surv_loca_id) cnt "
+ " FROM location l "
+ " LEFT OUTER JOIN surveyH b "
+ " ON l.loca_id = b.surv_loca_id "
+ " WHERE l.loca_name like '%:locaName%' "
+ " GROUP BY l.loca_id, l.loca_name "
+ " ORDER BY l.loca_id"
rest 이런 식으로 하면 searchValue를 인식하지 못함
@NamedNativeQuery(
name = "F_getSurveyListDept.surveyListDeptAllFind",
query = " SELECT l.loca_name name "
+ " , l.loca_id id "
+ " , COUNT(b.surv_loca_id) cnt "
+ " FROM location l "
+ " LEFT OUTER JOIN surveyH b "
+ " ON l.loca_id = b.surv_loca_id "
+ " WHERE l.loca_name like :locaName "
+ " GROUP BY l.loca_id, l.loca_name "
+ " ORDER BY l.loca_id"
이런 식으로 네임드 파라미터로 한 다음에
return surveyService.surveyListDeptAllFind( "%"+locaName+"%");
저런 식으로 파라미터 삽입할 때 바꿔주면 됨
참고한 곳: http://stackoverflow.com/questions/17611538/how-to-use-like-predicate-and-in-jpa-hibernate-namednativequery-and-sprin
댓글
댓글 쓰기