
쿼리 메소드 (Query Method) 1. 쿼리 메소드 (Query Method) Spring Data JPA 에서 제공하는 핵심 기능 중 하나로 Repository 인터페이스에 간단한 네이밍 룰에 따라 메소드를 작성하면, 원하는 쿼리를 실행하도록 지원하는 메소드 2. 쿼리 메소드 문법 find 문법 find + (엔티티 이름) + By + 변수이름 3. 쿼리 메소드 Sample 및 JPQL snippet KeywordSampleJPQL snippet Distinct findDistinctByLastnameAndFirstname select distinct … where x.lastname = ?1 and x.firstname = ?2 And findByLastnameAndFirstname … wher..

Section 1. 상품 Repository 설계 1. Spring Data JPA Spring Data JPA 개념(링크달기) 2. 상품 Repository 생성 com.shop.repository.ItemRepository.java 생성 DAO 역할을 수행하는 Repository 인터페이스 JpaRepository 클래스 extends package com.shop.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.shop.entity.Item; public interface ItemRepository extends JpaRepository { } 3. application-test.propertie..

Spring Boot Initializr Spring Boot 환경 구축 참고 (VSCODE, start(쓰니는 이거 안씀) OPEN_JDK(18)) Spring Initializr(maven) 에서 아래와 같이 설정 vscode springboot extension을 통해 빠르게 mvn 패키지를 생성할 수 있다. https://start.spring.io/ 위의 사이트를 통해서도 프로젝트를 생성할 수 있는데 압축파일을 풀고 열어야하는 약간의 번거로움이 있다. 프로젝트를 생성했으므로 생성한 프로젝트를 열어서 기본적인 세팅을 할 것인데 위와 같이 pom.xml에 아까 생성할때 넣었던 dependency들을 볼 수 있으며, 추후에 필요한 dependency를 pom.xml에 추가해 사용할 것이다. 이제 잘 ..