2
我有這樣的代碼不支持的功能異常fetchDmlReturnParams
String sql = "insert into colortable (string, color, cid) values (?,?,?)";
PreparedStatement ps = conn.prepareStatement(sql,keyProperties.toArray(new String[0]));
ps.executeBatch();
final ResultSet rst = ps.getGeneratedKeys();
while (rst.next()) {
final BigDecimal bigDecimal = rst.getBigDecimal(1);
if (bigDecimal != null) {
ids.add(bigDecimal.intValueExact());
}
}
當代碼到達rst.next我得到以下異常。
Caused by: java.sql.SQLException: Unsupported feature
at oracle.jdbc.driver.OracleStatement.fetchDmlReturnParams(OracleStatement.java:4959) ~[ojdbc6.jar:11.2.0.4.0]
at oracle.jdbc.driver.OracleReturnResultSet.next(OracleReturnResultSet.java:63) ~[ojdbc6.jar:11.2.0.4.0]
我發現問題出在這部分的ojdbc驅動程序中。
if (!this.statement.returnParamsFetched) {
this.statement.fetchDmlReturnParams();
this.statement.setupReturnParamAccessors();
}
在具體的功能this.statement.fetchDmlReturnParams();未實施。
現在我的問題是ho要避免調用這個函數,特別是returnParamFetched可以設置爲true嗎?