spring

프로그래밍 언어/JAVA

[JPA] Native Query 이용하여 테이블 여러 개 union 하고 Paging 처리하여 보여주기

Springboot 에서 JPA 를 이용하여 CRUD 작업을 하는 플젝을 진행하던 중 오류가 발생하여 그 tracking 과정을 정리해보았다. | 발생오류 로그 "message": "could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet" | Issue Tracking 기본적으로 DB와 같은 구조를 가진 Entity 클래스의 Repository interface 를 생성하고 그 안에 JPA 쿼리문 작업을 진행한다. public interface TestRepository extends JpaRepository { JPARep..

프로그래밍 언어/JAVA

[SpringBoot] 지정 시간에 배치 @Scheduled cron 속성 세팅 방법

스프링 부트 이용하여 배치 작업하는 코드 작성하기 @Scheduled(cron = "0 0 12 * * *") public void startBatch(){ log.info("배치 시작"); batchService.checkService(); log.info("배치 끝"); } 매일 정오에 checkService()가 실행되기 위해서는 Service에 위와 같이 코드를 작성한다. 사용 예 표현식 의미 0 0 12 * * * 매일 12시에 실행 0 15 10 * * * 매일 10시 15분에 실행 0 * 14 * * * 매일 14시에 0분~59분까지 매분 실행 0 0/5 14 * * * 매일 14시에 시작해서 5분 간격으로 실행 0 0/5 14,18 * * * 매일 14시, 18시에 시작해서 5분 간격으로 ..

개발하는 채찡
'spring' 태그의 글 목록