title: Insert in oracle with Spring data JDBC CrudRepository using manual PK (not autogenerated)
body: <p>I'm getting the following error inserting in Oracle DB with Spring Data JDBC v1.0.4 (not JPA):</p>
  
  <pre><code>Caused by: org.springframework.dao.DataRetrievalFailureException: The generated key is not of a supported numeric type. Unable to cast [oracle.sql.ROWID] to [java.lang.Number]
      at org.springframework.jdbc.support.GeneratedKeyHolder.getKey(GeneratedKeyHolder.java:79) ~[spring-jdbc-5.1.4.RELEASE.jar:5.1.4.RELEASE]
      at org.springframework.data.jdbc.core.DefaultDataAccessStrategy.getIdFromHolder(DefaultDataAccessStrategy.java:323) ~[spring-data-jdbc-1.0.4.RELEASE.jar:1.0.4.RELEASE]
      at org.springframework.data.jdbc.core.DefaultDataAccessStrategy.insert(DefaultDataAccessStrategy.java:111) ~[spring-data-jdbc-1.0.4.RELEASE.jar:1.0.4.RELEASE]
      at org.springframework.data.jdbc.core.DefaultJdbcInterpreter.interpret(DefaultJdbcInterpreter.java:73) ~[spring-data-jdbc-1.0.4.RELEASE.jar:1.0.4.RELEASE]
      at org.springframework.data.relational.core.conversion.DbAction$InsertRoot.doExecuteWith(DbAction.java:110) ~[spring-data-jdbc-1.0.4.RELEASE.jar:1.0.4.RELEASE]
      at org.springframework.data.relational.core.conversion.DbAction.executeWith(DbAction.java:55) ~[spring-data-jdbc-1.0.4.RELEASE.jar:1.0.4.RELEASE]
  </code></pre>
  
  <p>It seems that the default implementation expects always an autogenerated key, but my table's primary key is a String.</p>
  
  <p>The entity to persist:</p>
  
  <pre><code>@Table("USERS")
  public class User implements Persistable&lt;String&gt; {
  
      @Transient
      @JsonIgnore
      private boolean newRow = false;
  
      @Id
      @Column("ID_USER")
      private String userId;
  
      @Column("NAME")
      private String name;    
  
      @Override
      @JsonIgnore
      public String getId() {
          return userId;
      }
  
      public void setNew(boolean newRow) {
          this.newRow = newRow;
      }
  
      @Override
      @JsonIgnore
      public boolean isNew() {
          return newRow;
      }
  
  }
  </code></pre>
  
  <p>The repository:</p>
  
  <pre><code>@Repository
  public interface UserRepository extends CrudRepository&lt;User, String&gt;, PagingAndSortingRepository&lt;User, String&gt; {
  
  }
  </code></pre>
  
  <p>The call to the repository:</p>
  
  <pre><code>public User create(User user) throws QOException {
      user.setNew(true);
      return userRepository.save(user);
  }
  </code></pre>
  
  <p>The exception is thrown in the last line of <code>insert</code> method in <code>org.springframework.data.jdbc.core.DefaultDataAccessStrategy</code>:</p>
  
  <pre><code>operations.update( //
          sql(domainType).getInsert(parameters.keySet()), //
          parameterSource, //
          holder //
  );
  // Next line is the problem
  return getIdFromHolder(holder, persistentEntity);
  </code></pre>
  
  <p>The problem is that KeyHolder interface has a method <code>getKey</code> that returns a Number and Oracle returns as generated KEY the ROWID... However the entity PK is not generated, the ID is set before the insert. </p>
  
  <p>I cannot understand what is wrong with that code, any help is welcome.</p>