본문 바로가기

Spring

JPA Query 모음

반응형

GroupBy 절

@Query("SELECT A FROM Predict A WHERE A.subjectName = :subjectName GROUP BY A.code")
	ArrayList<Predict> findBySubjectNameAndGroupByCode(@Param("subjectName")String subjectName);

 

AND 포함

@Query("SELECT A.code FROM Predict A WHERE A.subjectName = :subjectName AND A.sentence = :sentence")
	ArrayList<String> findCodesBySubjectNameAndSentence(@Param("subjectName")String subjectName, @Param("sentence")String sentence);
반응형

'Spring' 카테고리의 다른 글

Sentry + Spring Boot (monitoring tool)  (0) 2021.08.31
Spring 에러 전역 처리  (0) 2021.08.31
JPA, SQL Error: 1064, SQLState: 42000  (0) 2021.06.30
HttpInterceptor 공통 처리  (0) 2020.11.09
이클립스 프록시 설정  (0) 2020.08.20