title: No common interface to java.sql.ResultSet, CallableStatement, SQLInput
body: <h2>This is the situation</h2>
  
  <p>In <a href="http://www.jooq.org" rel="nofollow">jOOQ</a>, there is a lot of need for abstraction over JDBC. I want the jOOQ client code to be unaware of the fact, that some data is retrieved from a simple ResultSet, some data is retrieved from SQLInput (for UDTs), or from CallableStatements (for stored procedures/functions). Hence, I want to add abstraction over these JDBC types:</p>
  
  <pre><code>java.sql.ResultSet
  java.sql.CallableStatement
  java.sql.SQLInput
  java.sql.SQLOutput
  </code></pre>
  
  <p>Now they all work pretty much the same way. They usually have a <code>get</code> and <code>set</code> method for every data type in <code>java.sql.Types</code>. For example, they ship with methods like</p>
  
  <pre><code>BigDecimal getBigDecimal(int index);
  int getInt(int index);
  </code></pre>
  
  <p>And they all have methods like</p>
  
  <pre><code>boolean wasNull();
  </code></pre>
  
  <h2>The problem</h2>
  
  <p>Unfortunately, these JDBC interfaces don't extend a single common interface making lives easier for those who want to write generic JDBC code like this snippet here (just an example to support my question):</p>
  
  <pre><code>// As JDBC has no support for BigInteger types directly,
  // read a BigDecimal and transform it to a BigInteger
  BigDecimal result = null;
  
  if (source instanceof ResultSet) {
      result = ((ResultSet) source).getBigDecimal(index);
  }
  else if (source instanceof CallableStatement) {
      result = ((CallableStatement) source).getBigDecimal(index);
  }
  else if (source instanceof SQLInput) {
      result = ((SQLInput) source).readBigDecimal();
  }
  
  return result == null ? null : result.toBigInteger();
  </code></pre>
  
  <p>The above code needs to be written for all three of them, <code>ResultSet</code>, <code>CallableStatement</code>, <code>SQLInput</code>. And there are lots of similar examples</p>
  
  <h2>My question is</h2>
  
  <ul>
  <li>Does anyone know a JDBC extension library that solves this problem elegantly? </li>
  <li>Or should I write a simple wrapper class (or adapter) for all of these types myself?</li>
  <li>Or would you just accept that fact and keep duplicating internal library code?</li>
  </ul>
  
  <p><strong>Which solution do you prefer and why?</strong> Thanks for any feedback</p>