0

So I'm trying to use Specification with projection, this is a new feature on Spring Boot 3.

UserRepository repo;
Specification<User> spec;
Page<UserProjection> result = repo.findBy(spec, q -> q.as(UserProjection.class).page(pageable));

as viewed here https://github.com/spring-projects/spring-data-jpa/issues/2499

But this implementation generates the same SQL as the regular findAll

UserRepository repo;
Specification<User> spec;
Page<User> result = repo.findAll(spec, pageable);

With the same SQL the use of projections is meaningless. Is there anything missing on this implementation?

Riberto Junior
  • 171
  • 1
  • 8

0 Answers0