fix: 修复 updateAndReturnKeys 执行无参 SQL 无法获取生成的 key 的问题

This commit is contained in:
2026-06-05 21:12:25 +08:00
parent f5909818c3
commit 486d0c98c7

View File

@@ -203,7 +203,7 @@ class JdbcOperationSupport {
}
else {
try (Statement stmt = conn.createStatement()) {
stmt.executeUpdate(sql);
stmt.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
try (ResultSet generatedKeys = stmt.getGeneratedKeys()) {
final ResultHandler<List<T>> resultHandler = ResultHandler.mapToList(rowMapper);
return resultHandler.handle(generatedKeys);