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
- 리소스 서버
- 브루트포스
- @ConfigurationProperties
- 다익스트라
- AuthenticationPrincipal
- JPA
- 백기선
- application.properties
- 백트래킹
- 외부설정
- @Profile
- 알고리즘
- OAuth2
- 스프링 부트
- Application Runner
- WebApplication Type
- 정적 리소스
- rest api
- Spring Security
- HATEOAS
- EnableAutoConfiguration
- 리소스핸들러
- Application Argument
- webjar
- 백준
- JsonSerializer
- 스프링부트
- Application Event
- HttpMessageConverters
- cors
Archives
- Today
- Total
아카이브
[스프링 데이터 JPA] 스프링 데이터 JPA 3. 쿼리 메서드 본문
https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation
Spring Data JPA - Reference Documentation
Example 109. Using @Transactional at query methods @Transactional(readOnly = true) public interface UserRepository extends JpaRepository { List findByLastname(String lastname); @Modifying @Transactional @Query("delete from User u where u.active = false") v
docs.spring.io
스프링 데이터 JPA에서 지원하는 키워드
- And, Or
- Is, Equals
- LessThan, LessThanEqual, GreaterThan, GreaterThanEqual
- After, Before
- IsNull, IsNotNull, NotNull
- Like, NotLike
- StartingWith, EndingWith, Containing
- OrderBy
- Not, In, NotIn
- True, False
- IgnoreCase
쿼리 찾아쓰기
- 엔티티에 정의한 쿼리 찾아 사용하기 JPA Named 쿼리
- @NamedQuery
- @NamedNativeQuery
- 리포지토리 메서드에 정의한 쿼리 사용하기
- @Query
- @Query(nativeQuery=true)
@NamedQuery
@NamedQueries({
@NamedQuery(name = "all_post", query = "SELECT p FROM Post AS p"),
@NamedQuery(name = "Post.findByTitle", query = "SELECT p FROM Post AS p WHERE p.title = ?1")
})
@Entity
public class Post extends AbstractAggregateRoot<Post> {}
@Query
@Query("SELECT p FROM Post AS p WHERE p.title = ?1")
List<Post> findByTitle(String title);
'Spring > 스프링 데이터 JPA' 카테고리의 다른 글
[스프링 데이터 JPA] 스프링 데이터 JPA 5. 쿼리 메서드 Named Parameter과 SpEL (0) | 2021.01.16 |
---|---|
[스프링 데이터 JPA] 스프링 데이터 JPA 3. 쿼리 메서드 (0) | 2021.01.16 |
[스프링 데이터 JPA] 스프링 데이터 JPA 2. Entity.save() (0) | 2021.01.16 |
[스프링 데이터 JPA] 스프링 데이터 JPA 1. JPA Repository (0) | 2021.01.16 |
[스프링 데이터 JPA] 스프링 데이터 Common 10. QueryDSL (0) | 2021.01.16 |