
[스프링 데이터 JPA 쿼리 메서드] 목표 순수 JPA리포지토리와 쿼리 메서드 비교하기(이름과 나이를 기준으로 회원 조회하는 쿼리 비교하기) 순수 JPA 리포지토리 1. 순수 JPA 리포지토리 작성하기 public List findByUsernameAndAgeGreaterThan(String username, int age) { return em.createQuery("select m from Member m where m.username = :username and m.age > :age") .setParameter("username", username) .setParameter("age", age) .getResultList(); } 이 코드는 리포지토리를 생성한 후 쿼리문을 문자열 형태로 만든다. ..