Framework/Springboot

[SpringBoot] ์Šคํ”„๋ง JPA limit pagesize ์ตœ๋Œ€๊ฐ’(maxSize) ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

yuri lee 2023. 2. 12. 13:47
๋ฐ˜์‘ํ˜•

Intro

์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ์‹œ๊ฐ„์—๋Š” ์Šคํ”„๋ง JPA์—์„œ pageSize ํŽ˜์ด์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ ์ตœ๋Œ€๊ฐ’์œผ๋กœ ์ง€์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. 

 

How to set to maxSize

@PageableDefault ์–ด๋…ธํ…Œ์ด์…˜์„ ํ™œ์šฉํ•˜์—ฌ, size๋ฅผ Integer.MAX_VALUE๋กœ ์„ค์ •ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. size๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด, 2000์œผ๋กœ ์„ค์ •๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 

public SomeResponseObject getSomething(
    @PageableDefault(size = Integer.MAX_VALUE) Pageable page
) {
    return someService.getSomething(page);
}

 

 


https://stackoverflow.com/questions/23751193/spring-data-jpa-limit-pagesize-how-to-set-to-maxsize

๋ฐ˜์‘ํ˜•