title: Spring Data R2DBC parameters conditional binding for SQL query
body: <p>I am facing a difficulty to bind a conditional parameters to SQL query using Spring Data R2DBC DatabaseClient. Two parameters can be null. Since the DatabaseClient requires to specify explicitly that the parameter is null, I have tried the following syntax but the conditional parameters were not appended to existing ones:</p>
  <pre><code>public Mono&lt;Void&gt; createAddress(Address address) {
      DatabaseClient.GenericExecuteSpec bindings = databaseClient.execute(addressesQueries.getProperty(&quot;addresses.insert&quot;))
              .bind(&quot;line1&quot;, address.getLine1())
              .bind(&quot;zipCode&quot;, address.getZipCode())
              .bind(&quot;city&quot;, address.getCity())
              .bind(&quot;countryId&quot;, address.getCountry())
              .bind(&quot;id&quot;, address.getId()); // UUID
  
              if(address.getLine2() == null) {
                  bindings.bindNull(&quot;line2&quot;, String.class);
              } else {
                  bindings.bind(&quot;line2&quot;, address.getLine2());
              }
              if(address.getState() == null) {
                  bindings.bindNull(&quot;state&quot;, String.class);
              } else {
                  bindings.bind(&quot;state&quot;, address.getState());
              }
  
      return bindings.fetch().rowsUpdated().then();
  }
  </code></pre>
  <p>SQL query:</p>
  <pre><code>INSERT INTO addresses(id,line1,line2,zip_code,city,state,country) VALUES(:id,:line1,:line2,:zipCode,:city,:state,:countryId)
  </code></pre>
  <p>I know that I can split the SQL query to handle cases with/without null parameters but it will be a little bit complicated if I have more that one conditional parameter.</p>
  <p>Do you know a solution that can help me to keep one SQL query and handle conditional parameters in Java code?</p>