화면정의서대로 개발을 해도 사용자는 더 많은 것을 요구하고 요청을 하게되네요.
그래도 그런것때문에 JPA 에서 간단하게 사용할 수 있는 것을 배워갑니다.
@Query(value = "select toi from TbOrderInfo toi where toi.deliveryDt between :stDt and :edDt and toi.orderCompanyId In (:companyIds)",
nativeQuery = false)
Page<TbOrderInfo> findByOrderInfoListJpql(@Param("stDt") String stDt, @Param("edDt") String edDt, @Param("companyIds") List<Long> companyIds , Pageable pageable);
위의 예시처럼 사용하시면 됩니다.
제가 참고한 사이트는 아래와 같습니다.
https://javadeveloperzone.com/spring/spring-jpa-query-in-clause-example/
Spring JPA query IN clause example - Java Developer Zone
Here is article of Spring JPA query IN clause example and Spring data JPA IN and NOT IN query with example, dyanic IN and NOT IN query with spring JPA.
javadeveloperzone.com
항상 생각하지만 간단한건 세상에 없는것 같습니다. ^^
오늘도 한개를 알고 가네요.
JPA도 공부할 것이 많네요.
[JWT] Springboot jwt MAVEN 추가하는 방법 (0) | 2022.04.08 |
---|---|
Springboot Schedule Task 사용하기 (0) | 2022.02.28 |
JPA Pageable 에서 sort 하기 (0) | 2022.01.27 |
JPA Entity Sequence 매핑 적용 (0) | 2022.01.17 |
JPA like 검색 적용하는 방법 (0) | 2022.01.13 |