Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

377
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda