title: NamedParameterJdbcTemplate set params with OR operator and check for null
body: <pre><code>class Request{
      private string f1;
      private string f2;
      private string f3;
  }
  </code></pre>
  
  <p>I have the following query </p>
  
  <pre><code>SELECT * FROM tbl WHERE f1  = 'val' OR f2  = 'val2' OR f3  = 'va3'
  </code></pre>
  
  <p>fields from <code>Request</code> can be <code>null</code>. I need to create <code>NamedParameterJdbcTemplate</code> query and check each field for <code>null</code>.</p>
  
  <pre><code>String query = "SELECT * FROM tbl"; 
  if (request.getF1() !=null &amp;&amp; !request.getF1().isEmpty()){
              query += ....
          } 
  </code></pre>
  
  <p>This is a very bad solution....</p>
  
  <p>Can I create something like </p>
  
  <pre><code> Map&lt;String, Object&gt; namedParameters = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>to check all fields for <code>null</code> and if not <code>null</code> add to map and set to query? And set operator <code>OR</code> </p>