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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With