Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

683
Views
Specifying Result limit using JPA Specification

Is there possibility to use limit or setMaxResults using Spring-Data-JPA Specification? I can use it via Criteria or JPQL, but I need only via specifications. Specifications have CriteriaQuery, not a Query. So, there is no setMaxResults method.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I think you only have two options:

Use Pageable with your Specification:

Pageable limit = new PageRequest(0,10);
repo.findAll(spec, limit);

or do a workaround like this one: https://gist.github.com/tcollins/0ebd1dfa78028ecdef0b. All the credits to @tcollins

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!