jdbcclient: JdbcClient on Spring Framework 7.0.10 / Boot 4.1.2, with twelve real transcripts
Parameters, row mapping, single/optional/list, generated keys, batch via NamedParameterJdbcTemplate (JdbcClient has none), exception translation, transactions, an unclosed stream() exhausting a 2-connection pool, withMaxRows truncating silently, and spring.jdbc.template.* reaching the auto-configured JdbcClient. JdbcClient API diffed across 6.1.0, 6.2.19 and 7.0.0. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5n3PRbPkUsiJybTeg
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
260c8a692f
commit
fc8bc933d5
@@ -0,0 +1,15 @@
|
||||
1 .param(v).param(v) ? placeholders -> [Mechanical Keyboard]
|
||||
2 .param(1, v) by index -> [Mechanical Keyboard]
|
||||
3 .params(List.of(..)) ? placeholders -> [Wireless Mouse, Headset]
|
||||
4 .param("sku", v) :named -> [Mechanical Keyboard]
|
||||
5 .params(Map.of(..)) :named -> [Mechanical Keyboard]
|
||||
6 .paramSource(record) :named, record -> [Mechanical Keyboard]
|
||||
7 :p used twice, one .param("p", 10) :named -> [KB-001, MS-002]
|
||||
8 IN (:skus) with a 3-element list expanded -> [KB-001, WC-005] (NOPE matched nothing)
|
||||
9 LIKE :q with "%o%" wildcard in value -> [Mechanical Keyboard, Wireless Mouse, Monitor 27 inch]
|
||||
|
||||
10 :named and ? in one statement -> java.lang.IllegalStateException: Configure either named or indexed parameters, not both
|
||||
11 typo in the parameter name (:sku, supplied skuu) -> org.springframework.dao.InvalidDataAccessApiUsageException: No value supplied for the SQL parameter 'sku': No value registered for key 'sku'
|
||||
12 two ? but one value -> org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [SELECT name FROM product WHERE sku = ? AND in_stock = ?]; Parameter "#2" is not set; SQL statement: SELECT name FROM product WHERE sku = ? AND in_stock = ? [90012-240] [root cause: JdbcSQLDataException: Parameter "#2" is not set; SQL statement: SELECT name FROM product WHERE sku = ? AND in_stock = ? [90012-240]]
|
||||
13 .param("sku", null) -> ran, rows: 0 (= NULL is never true)
|
||||
.param("sku", null, Types.VARCHAR) -> ran, rows: 0 (= NULL is never true)
|
||||
Reference in New Issue
Block a user