新增行并返回主键值问题

u014388068 2014-03-27 11:20:46
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: 不支持的特性
...全文
52 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧