목록JPA (2)
코딩마을방범대

JpaSpecificationExecutor Spring Data JPA에서 제공하는 인터페이스DB 쿼리의 조건을 간단히 Spec으로 작성하여 날릴 수 있게 해줌(Spec으로 관리하게 되면 코드가 깔끔해지며 유지보수가 좀 더 용이해짐)JPA Criteria API를 활용하여 복잡한 동적 쿼리를 작성할 수 있음 주요 메서드유형메서드설명ListfindAll(Specification spec)엔티티 조회PagefindAll(Specification spec, Pageable pageable)엔티티 조회 ListfindAll(Specification spec, Sort sort)엔티티 조회 OptionalfindOne(Specification spec)단일 엔티티 조회 RfindBy(Specification s..

JPA가 제공하는 쿼리 메서드는 단순한 CRUD 기능이 가능하여 편리함을 제공하기는 하지만,복잡한 조건을 처리해야하는 경우에는 한계가 있다.이럴 때 사용하는 것이 @Query 어노테이션이다. JPA 쿼리 메서드의 정의는 아래 링크를 통해 확인 가능하다. JPA Query Methods :: Spring Data JPAAs of Spring Data JPA release 1.4, we support the usage of restricted SpEL template expressions in manually defined queries that are defined with @Query. Upon the query being run, these expressions are evaluated against..