You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
selectperson0_.idas id1_0_,
person0_.ageas age2_0_,
person0_.heightas height3_0_,
person0_.used_ynas used_yn4_0_,
person0_.usernameas username5_0_,
person0_.weightas weight6_0_
from
person person0_
order byperson0_.usernameascperson0_.usernamedescperson0_.usernameascperson0_.usernameasc, person0_.ageasc
Pageable
쿼리 생성할 때 페이징하고 싶을 때 파라미터로 사용된다.
JpaRepository가 상속한 클래스 중 PagingAndSortingRepository가 있는데 기본적으로 아래와 같이 구현도 되어 있다.
publicinterfacePagingAndSortingRepository<T, ID> extendsCrudRepository<T, ID> {
/** * Returns a {@link Page} of entities meeting the paging restriction provided in the {@link Pageable} object. * * @param pageable the pageable to request a paged result, can be {@link Pageable#unpaged()}, must not be * {@literal null}. * @return a page of entities */Page<T> findAll(Pageablepageable);
}
Pageable을 파라미터로 넘겨줄 때 인터페이스이기 때문에 객체로 만들어줄 수 없다.
그래서 아래 보면 Pageable을 구현한 PageRequest가 있는데 이것을 이용해 파라미터로 전달한다.