title: Workaround for "null primitives" in JDBC PreparedStatement?
body: <p>When using raw JDBC, you can parameterize a <code>PreparedStatement</code> like so:</p>
  
  <pre><code>PreparedStatement statement = connection.prepareStatement(someSQLString);
  String someString = getSomeString();
  Integer int = getSomeInteger();
  statement.setString(1, someString);
  statement.setLong(2, 5L);
  statement.setInt(3, int);
  
  ...
  </code></pre>
  
  <p>Here, if <code>someString</code> is <code>null</code>, that's fine - strings are nullable. But if <code>getSomeInteger()</code> returns <code>null</code>, we have a problem.</p>
  
  <p><code>PreparedStatement#setInt(int,int)</code> sets a primitive <code>int</code> as the value, and therefore cannot be <code>null</code>.</p>
  
  <p><strong>However, it's perfectly plausible that I might want the value of the 3rd column above to be <code>null</code> for this particular record.</strong> After all, every RDBMS I've ever worked with allows numeric (INT, LONG, etc.) fields to be NULLABLE...</p>
  
  <p>So what's the workaround?</p>