BoardSearchImpl
페이지 정보
본문
package web.repository;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
import com.querydsl.jpa.JPQLQuery;
import web.domain.Board;
import web.domain.QBoard;
public class BoardSearchImpl extends QuerydslRepositorySupport implements BoardSearch{
public BoardSearchImpl() {
super(Board.class);
}
@Override
public Page<Board> search1(Pageable pageable) {
QBoard board = QBoard.board; //Q도메인 객체 선언 및 초기화
JPQLQuery<Board> query = from(board); //select ... from board (쿼리 부분)
query.where(board.title.contains("1")); //where title like '%1%' (쿼리 부분)
//paging
this.getQuerydsl().applyPagination(pageable, query);
List<Board> list = query.fetch();
long count = query.fetchCount();
return null;
}
}
- 이전글● Querydsl로 Pageable 처리 하기 24.06.17
- 다음글BoardRepositoryTest 24.06.17
댓글목록
등록된 댓글이 없습니다.