250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- exclusive lock
- 유니크제약조건
- SQL프로그래밍
- BOJ
- 스토어드 프로시저
- 동적sql
- 낙관적락
- FetchType
- 즉시로딩
- 지연로딩
- 스프링 폼
- JPQL
- execute
- fetch
- PS
- 데코레이터
- dfs
- 일대다
- 다대다
- 이진탐색
- 백트래킹
- 연관관계
- querydsl
- 연결리스트
- CHECK OPTION
- eager
- shared lock
- 다대일
- 비관적락
- 힙
Archives
- Today
- Total
흰 스타렉스에서 내가 내리지
[JPA] Spring-data-JPA 의 메소드 이름으로 쿼리 생성 본문
728x90
이메일과 이름으로 회원을 조회하려면 다음과 같은 메소드를 정의하면 된다.
List<Member> findByEmailAndName (String email, String name);
메소드를 실행하면 스프링 데이터 JPA 는 메소드 이름을 분석해서 JPQL 을 생성하고 실행한다.
실행된 JPQL :
select m from Member m where m.email = ?1 and m.name = ?2
# JPA Query Method 표
https://docs.spring.io/spring-data/jpa/reference/jpa/query-methods.html
JPA Query Methods :: Spring Data JPA
By default, Spring Data JPA uses position-based parameter binding, as described in all the preceding examples. This makes query methods a little error-prone when refactoring regarding the parameter position. To solve this issue, you can use @Param annotati
docs.spring.io
'JPA' 카테고리의 다른 글
테스트 환경에서 엔티티 비교 (0) | 2024.04.28 |
---|---|
[Spring-data-JPA] 벌크성 수정 쿼리 (0) | 2024.04.25 |
[JPA] 엔티티의 데이터를 변환해서 DB 에 저장하는 @Converter (0) | 2024.04.25 |
[JPA] N+1 문제 (실은 1+N 문제) (0) | 2024.04.25 |
트랜잭션 범위의 영속성 컨텍스트 (0) | 2024.04.25 |