I am using QueryDSL with SpringData. I have Table say, Employee and I have created entity class say, EmployeeEntity I have written following service method As in above I commented the NPException. How to use QueryDSL for optional Parameters in QueryDSL using Spring Data? Thank you 🙂 Answer BooleanBuilder can be used as a dynamic builder for boolean expressions: