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 |
Tags
- 지연로딩
- 이진탐색
- 다대일
- querydsl
- 비관적락
- 힙
- 즉시로딩
- 스토어드 프로시저
- FetchType
- execute
- SQL프로그래밍
- 백트래킹
- BOJ
- 낙관적락
- 동적sql
- exclusive lock
- 유니크제약조건
- PS
- 다대다
- 일대다
- 스프링 폼
- 연관관계
- JPQL
- 연결리스트
- CHECK OPTION
- dfs
- shared lock
- 데코레이터
- eager
- fetch
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 |