title: How to get java Class object according JDBCType
body: <p>I'm trying to implement data transfer from one DB type to another via JDBC. </p>
  
  <p>With <code>connection.getMetaData().getColumnType()</code> I can get JDBCType of column.</p>
  
  <p>How can I use it to get java Class object to be able to use <code>resultSet.getObject(i, XXX.class)</code>?</p>
  
  <p>Of course I can do something like this <a href="https://stackoverflow.com/a/5253901/7849631">https://stackoverflow.com/a/5253901/7849631</a></p>
  
  <p>Does any library already implements this accoridng DB vendor? Or maybe there is special result set floating somewhere?</p>
  
  <p>Here's a simple example to understand my problem:</p>
  
  <pre><code>private List&lt;Map&lt;String, Object&gt;&gt; readDataFromResultSet(ResultSet resultSet, Map&lt;String, JDBCType&gt; columnNamesTypes) throws SQLException {
          List&lt;Map&lt;String, Object&gt;&gt; dataToTransfer = new ArrayList&lt;&gt;();
          while (resultSet.next()) {
              Map&lt;String, Object&gt; value = new LinkedHashMap&lt;&gt;();
              for (String columnName : columnNamesTypes.keySet()) {
                  final JDBCType type = columnNamesTypes.get(columnName);
                  value.put(columnName, resultSet.getObject(columnName, **convertJDBCTypeToClass**(type)));
              }
              dataToTransfer.add(value);
          }
          return dataToTransfer;
      }
  </code></pre>
  
  <p>UPDATE: this has been resolved with org.hibernate.type.descriptor.sql.JdbcTypeJavaClassMappings</p>