title: How to retrive a generated primary key when a new row is inserted in the oracle database using Spring JDBC?
body: <p>Below is the code I am using to save a record in the database and then get the generated primary key. </p>
  
  <pre><code>public void save(User user) {
      // TODO Auto-generated method stub
      Object[] args = { user.getFirstname(), user.getLastname(),
              user.getEmail() };
      int[] types = { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR };
  
      SqlUpdate su = new SqlUpdate();
  
      su.setJdbcTemplate(getJdbcTemplate());
      su.setSql(QUERY_SAVE);
  
      setSqlTypes(su, types);
  
      su.setReturnGeneratedKeys(true);
      su.compile();
  
      KeyHolder keyHolder = new GeneratedKeyHolder();
  
      su.update(args, keyHolder);
  
      int id = keyHolder.getKey().intValue();
  
      if (su.isReturnGeneratedKeys()) {
          user.setId(id);
      } else {
          throw new RuntimeException("No key generated for insert statement");
      }
  }
  </code></pre>
  
  <p>But its not working, It gives me following error. </p>
  
  <pre><code>The generated key is not of a supported numeric type. Unable to cast [oracle.sql.ROWID] to [java.lang.Number]
  </code></pre>
  
  <p>The row is being inserted in the database properly. As well I could get the generataed primary key when using MS SQL database but the same code is not working with the ORACLE 11G. </p>
  
  <p>Please help. </p>