JPA/queryDsl

QueryDsl between

lovineff 2023. 5. 30. 20:02

QueryDsl Between 사용 방법

// 값 설정
String yyyyMMdd = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));


// 다른부분 생략
jpaQueryFactory
.where(Expressions.asString(yyyyMMdd).between(entity.startDate, entity.endDate))


// 실행 결과
and ('20230530' between p010.START_DATE and p010.END_DATE)