본문 바로가기
Spring Framework/JPA

JPA 쿼리메소드 LocalDateTime 조회 조건 설정방법

by wakestand 2022. 12. 7.
반응형

JPA Repository에 쿼리 메소드를 작성 시

LocalDateTime 타입 컬럼 조회조건을 설정해 주려면

아래와 같은 방식으로 사용해주면 된다

 

between

List<Test> findBy컬럼명Between(LocalDateTime startDateTime, LocalDateTime endDateTime);

 

>

List<Test> findBy컬럼명After(LocalDateTime localDateTime);
List<Test> findBy컬럼명GreaterThan(LocalDateTime localDateTime);

 

>=

List<Test> findBy컬럼명GreaterThan(LocalDateTime localDateTime);

 

<

List<Test> findBy컬럼명Before(LocalDateTime localDateTime);
List<Test> findBy컬럼명LessThan(LocalDateTime localDateTime);

 

<=

List<Test> findBy컬럼명LessThanEqual(LocalDateTime localDateTime);

반응형

댓글