我有一個方法,我只從資料庫中傳遞6個物件:
StudentDTO students = StudentDTO.builder()
.fieldName("學生城")
.postDTOS(postRepository.findStudentByCity(
PageRequest.of(pageable.getPageNumber(), 6)
.map(postMapper::toPostDTO).toSet()).build()。
我怎樣才能重寫它,以便傳遞所有的值,而不是6呢?
uj5u.com熱心網友回復:
使用Pageable.unpaged();來獲取所有的記錄:
StudentDTO students = StudentDTO.builder()
.fieldName("學生城")
.postDTOS(postRepository.findStudentByCity(
Pageable.unpaged())
.map(postMapper::toPostDTO).toSet()).build()
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/317521.html
標籤:
上一篇:如何映射非相關的JPA物體
下一篇:對不同的物體采用不同的模式
