querydsl

querydsl page 처리 with group by

jinheung90 2023. 3. 2. 18:51

항상 느끼는 것이지만 뭐든지 작은 의심을 시작하게 되면서 사서고생을 하게 된다.

 

예전에 만들어둔 page 제네릭 메서드가 있다

너 왜 노란 줄 뜨니?  이 의심을 하고 다시보니  제거 예정이란다. 

왜??????

여기에 나와있는데 변역하면 

http://querydsl.com/static/querydsl/5.0.0/apidocs/deprecated-list.html

 

Deprecated List (Querydsl 5.0.0 API)

JavaScript is disabled on your browser. Deprecated Methods  Method and Description com.querydsl.sql.codegen.NamingStrategy.appendSchema(String, String) com.querydsl.jpa.impl.AbstractJPAQuery.fetchCount() com.querydsl.jpa.impl.AbstractJPAQuery.fetchResults

querydsl.com

 

번역 부분 

queries with multiple group by clauses and queries with a having clause turn out to be problematic. This is because COUNT(DISTINCT a, b, c), while valid SQL in most dialects, is not valid JPQL. -> 어?  group by clauses and queries with a having clause 이거에 문제가 있어? 마침 내가 짜고 있는 쿼리를 보고 어? 나 group by 쓰는데? 바꾸기로 결심했다

 

fetchcount는 똑같은 쿼리를 날리는데 group by자체가 비용이 큰 쿼리라서 또 날리지 말라는 소리였다.

결론 카운트 쿼리는 새로 만들어 줬다. 

 

전 회사에서 만든 쿼리가 부끄러워진다 사실 전회사에서는 group by와 같은 쿼리를 날릴일이 없었는데 이번회사 오고 버전업을 하면서 고민하고 많이 알아가는 시간이였습니다.