BoardRepositoryTest > SPRING_DATA_JPA

본문 바로가기

사이트 내 전체검색

뒤로가기 SPRING_DATA_JPA

BoardRepositoryTest

페이지 정보

작성자 관리자 작성일 24-06-17 10:24 조회 905 댓글 0

본문

package web.repository;


import java.util.Optional;

import java.util.stream.IntStream;


import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.boot.test.context.SpringBootTest;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.PageRequest;

import org.springframework.data.domain.Pageable;

import org.springframework.data.domain.Sort;


import jakarta.transaction.Transactional;

import lombok.extern.log4j.Log4j2;

import web.domain.Board;


@SpringBootTest

@Log4j2

public class BoardRepositoryTest {


@Autowired

private BoardRepository boardRepository;


@Test //추가 테스트

public void testSearch1() {

// 2 page order by bno desc 

Pageable pageable = PageRequest.of(1, 10, Sort.by("bno").descending());


boardRepository.search1(pageable);

}


}





[콘솔 확인]
Hibernate: 
    select
        b1_0.bno,
        b1_0.content,
        b1_0.moddate,
        b1_0.regdate,
        b1_0.title,
        b1_0.writer 
    from
        board b1_0 
    where
        b1_0.title like ? escape '!' 
    order by
        b1_0.bno desc 
    limit
        ?, ?
Hibernate: 
    select
        count(b1_0.bno) 
    from
        board b1_0 
    where
        b1_0.title like ? escape '!'

댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기