JdbcTemplate.update() 返回受影响的行数 - 因此您不仅知道删除/更新是成功的,还知道删除/更新了多少行.
如果我尝试插入一行,返回值是多少.
是否有可能将返回值设为"0"?
private static final String insertSql =
"INSERT INTO employee (" +
" name, " +
" surname, " +
" title, " +
" created) " +
"VALUES (John, Smith, Software developer, new Date())";
int row = template.update(insertSql, params, types);
Run Code Online (Sandbox Code Playgroud)