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

374
Views
QueryDsl how to use exist() to return boolean

I want to upgrade queryDsl from verision 3 to version 4. But i've an issue with exist() In QueryDsl 3 exist return a Boolean but in QUeryDSL 4 it return a BooleanOperation. In my case i really want the boolean but i don't know how to retrieve it.

The best solution i've found is to do

.fetchCount() >0 

But I want to know if another (better) solution exist.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Another option would be something like:

queryFactory.select(queryField).from(qTable)
            .where(queryField.eq(value))
            .groupBy(queryField)
            .having(qTable.uuid.count().gt(0))
            .fetchOne() != null;

This passes the greater than responsibility over to the query. However it is possibly less readible so will depend on the requirements which is better.

over 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!