JPA Specification1 Spring JPA Specification을 사용해 유연하게 조회 API 만들기 초기 프로젝트가 작았을 때, 조회 API를 만드는 것은 크게 어렵지 않았습니다. 하지만 기능이나 데이터가 추가되면서 조건식이 추가될 때마다 Repository 메서드를 만들어야 하는 게 너무 비효율적이었습니다. 혹시나 구글링을 해보니 JPA에서 Specification라는 것을 제공해주네요. 일단 Specification을 적용하기 전부터 보겠습니다. Person, Team 엔터티와 Controller, Repository를 만들었습니다. Person.class @Entity @Getter public class Person { @Id @GeneratedValue @Column(name = "person_id") private Long id; private String firstName; private .. 2021. 11. 8. 이전 1 다음 728x90