mysema/querydsl — Issue #97: SQL - Accessing generated keys fails for Oracle
Author: olivergierke
Created: 2012-02-09 09:35:56+00:00
State: open

`SQLInsertClause.prepareStatementAndParameters(…)` uses `connection.prepareStatement(String sql, int flag)` to pipe in a constant trying to trigger the underlying database to return auto-generated key. However with recent Oracle drivers ojdbc14, ojdbc5, ojdbc6 this causes a `ROWID` to be returned in the key `ResultSet` which in turn cannot be accessed with `rs.getBigDecimal(…)` or the like (we get a driver exception claiming that `getBigDecimal(…)` is not implemented for `T4CRowIdAccessor`)

We were trying to use Spring JDBC to reproduce the issue and used `connection.prepareStatement(String sql, String[] keyColumns)` which then correctly returned the generated key in the format expected (`BigDecimal` in our case). I don't know in how far a change to use this method for statement setup might affect other databases.