title: Spring Data + QueryDSL empty predicate + Predicate chaining
body: <p>let me get straight to the point.
  I am using Spring Data JPA with QueryDSL in a project and I cannot figure out this myself.</p>
  
  <p>I have the QueryDSL predicates in static methods that can take arguments and if the argument is not correct it should return "empty predicate" :</p>
  
  <pre><code>public static BooleanExpression byWhateverId(Long whateverId) {
    if(whateverId == null) return [insert magic here];
    // if parameter is OK return usual predicate
    return QClass.property.whateverId.eq(whateverId);
  }
  </code></pre>
  
  <p>Now I want to be able to chain these predicates using AND/OR oprators :</p>
  
  <pre><code>someRepository.findAll(byWhateverId(someParam).and(bySomethingElseId(1));
  </code></pre>
  
  <p>The problem here is that at this point I don't know whether 'someParam' is null or not (of course I can check but that's a lot of IFs).
  I also know I can use BooleanBuilder class but that seems also like a lot of code that should not be needed.</p>
  
  <p>Does anybody knows what could be inserted instead of "[insert magic here]" ???
  Or maybe I am missing something somewhere...</p>
  
  <p>Thanks!</p>