新增行并返回主键值问题
KeyHolder keyHolder = new GeneratedKeyHolder();
getJdbcTemplate().update(new PreparedStatementCreator() {
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
PreparedStatement ps = connection.prepareStatement(
"INSERT INTO Test (id, name) VALUES (S_FDC_WAFERROUTE.NEXTVAL,?)", new String[] { "id" });
ps.setString(1, "heipark");
return ps;
}
}, keyHolder);
int generatedId = keyHolder.getKey().intValue();
System.out.println(generatedId);
为何执行以上方法总报以下错误?请帮忙
---------------------------------------------
PreparedStatementCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [17023]; 不支持的特性; nested exception is java.sql.SQLException: 不支持的特性