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
- 리소스핸들러
- webjar
- cors
- Application Runner
- OAuth2
- 백준
- EnableAutoConfiguration
- 리소스 서버
- 브루트포스
- 백기선
- JPA
- 스프링부트
- AuthenticationPrincipal
- JsonSerializer
- HttpMessageConverters
- Spring Security
- @ConfigurationProperties
- HATEOAS
- Application Argument
- rest api
- 백트래킹
- WebApplication Type
- @Profile
- 외부설정
- 다익스트라
- application.properties
- Application Event
- 스프링 부트
- 정적 리소스
- 알고리즘
Archives
- Today
- Total
아카이브
[스프링 데이터 JPA] 스프링 데이터 JPA 5. 쿼리 메서드 Named Parameter과 SpEL 본문
Named Parameter
- @Query에서 참조하는 매개변수를? 1,? 2 이렇게 채반으로 참조하는 게 아니라 이름으로 :title 이렇게 참조하는 방법은 다음과 같습니다.
@Query("SELECT p FROM Post AS p WHERE p.title = :title")
List<Post> findByTitle(@Param("title") String title, Sort sort);
SpEL(Spring Expression Language)
Core Technologies
In the preceding scenario, using @Autowired works well and provides the desired modularity, but determining exactly where the autowired bean definitions are declared is still somewhat ambiguous. For example, as a developer looking at ServiceConfig, how do
docs.spring.io
- 스프링 표현식 언어로 문자열을 처리해줌
@Query에서 엔티티 이름을 미리정의가 되어있는 #{#entityName} 으로 표현할 수 있습니다.
@Query("SELECT p FROM #{#entityName} AS p WHERE p.title = :title")
List<Post> findByTitle(@Param("title") String title, Sort sort);
'Spring > 스프링 데이터 JPA' 카테고리의 다른 글
[스프링 데이터 JPA] 스프링 데이터 JPA 7. EntityGraph (0) | 2021.01.16 |
---|---|
[스프링 데이터 JPA] 스프링 데이터 JPA 6. Update 쿼리 (0) | 2021.01.16 |
[스프링 데이터 JPA] 스프링 데이터 JPA 3. 쿼리 메서드 (0) | 2021.01.16 |
[스프링 데이터 JPA] 스프링 데이터 JPA 3. 쿼리 메서드 (0) | 2021.01.16 |
[스프링 데이터 JPA] 스프링 데이터 JPA 2. Entity.save() (0) | 2021.01.16 |