//Page<Board> result = (Page<Board>) repo.findAll();
Page<Board> result = repo.findAll(builder, pageable);
System.out.println("넘어오긴했음");
System.out.println("PAGE SIZE : "+result.getSize());
System.out.println("TOTAL PAGES : " + result.getTotalPages());
System.out.println("TOTAL COUNT : "+ result.getTotalElements());
System.out.println("NEXT : "+result.nextPageable());
//List<Board> list =new ArrayList<Board>(result.getContent());
//list.forEach(b -> System.out.println(b));
it returns java.lang.UnsupportedOperationException
how can i get Page by use findall method?
most said edit here
List<Board> list = result.getContent();
to
List<Board> list =new ArrayList<Board>(result.getContent());
but my problem is occured
Page<Board> result = repo.findAll(builder, pageable);
here is trace
java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableMap.put(Collections.java:1459)
at com.querydsl.jpa.JPQLSerializer.visitConstant(JPQLSerializer.java:327)
at com.querydsl.core.support.SerializerBase.visit(SerializerBase.java:221)
at com.querydsl.core.support.SerializerBase.visit(SerializerBase.java:36)
at com.querydsl.core.types.ConstantImpl.accept(ConstantImpl.java:140)
at
com.querydsl.core.support.SerializerBase.handle(SerializerBase.java:122)
at com.querydsl.core.support.SerializerBase.visitOperation(SerializerBase.java:301)
at com.querydsl.jpa.JPQLSerializer.visitOperation(JPQLSerializer.java:422)
at com.querydsl.core.support.SerializerBase.visit(SerializerBase.java:262)
at com.querydsl.core.support.SerializerBase.visit(SerializerBase.java:36)
at com.querydsl.core.types.OperationImpl.accept(OperationImpl.java:83)
at com.querydsl.core.support.SerializerBase.handle(SerializerBase.java:122)
at com.querydsl.core.support.SerializerBase.visitOperation(SerializerBase.java:298)
In PagingAndSortingRepository findAll
method allow only Pageable
parameter
public interface PagingAndSortingRepository<T, ID> extends CrudRepository<T, ID> {
Iterable<T> findAll(Sort var1);
Page<T> findAll(Pageable var1);
}
so if you want findAll method return Page
through querydsl
with builder
then extend CustomRepository like this custom-implementation-of-intermediate-repository-in-spring-data