title: Insert NULL into setDouble method Java
body: <p>My code attempting to insert NULL into setDouble method in PreparedStatement</p>
  
  <pre><code>ps.setDouble(++i, balance.getAmount());
  </code></pre>
  
  <p><strong>getAmount() is Double field</strong>.</p>
  
  <p>i am able to handle like </p>
  
  <pre><code>if (balance.getAmount() ==  null ) {
      ps.setNull(++i, java.sql.Types.NULL);
  }else{
      ps.setDouble(++i, balance.getAmount());
  }
  </code></pre>
  
  <p>But my code looks ugly, because my code have many number of setInt setLong setDouble methods.</p>
  
  <p>Is there any way to hanlde smartly or is there any other approach. Please advise me.</p>