## no filters: disappears completely ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p ORDER BY p.id ==> Parameters: <== Total: 45 ## only active = true: appears, no stray AND ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p WHERE p.active = ? ORDER BY p.id ==> Parameters: true(Boolean) <== Total: 41 ## name contains '1', price between 20 and 60 ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p WHERE p.name LIKE ? AND p.price >= ? AND p.price <= ? ORDER BY p.id ==> Parameters: %1%(String), 20(BigDecimal), 60(BigDecimal) <== Total: 10 ## categories 1 and 3, sorted by price desc (choose/when) ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p WHERE p.category_id IN (?,?) ORDER BY p.price DESC, p.id ==> Parameters: 1(Long), 3(Long) <== Total: 30 ## empty category list is ignored, not turned into IN () (sorted by name so it is a new statement, not a cache hit) ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p ORDER BY p.name, p.id ==> Parameters: <== Total: 45 ## findByIds([2, 4, 6]) -> foreach ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p WHERE p.id IN ( ? , ? , ? ) ORDER BY p.id ==> Parameters: 2(Long), 4(Long), 6(Long) <== Total: 3 ## findByIds([]) -> foreach over an empty list produces 'IN' with nothing after it exception: BadSqlGrammarException root cause: JdbcSQLSyntaxErrorException - Syntax error in SQL statement "SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p\000a WHERE p.id IN\000a \000a [*]ORDER BY p.id"; expected "("; SQL statement: ## updateSelective with only stock set -> writes just that column ==> Preparing: UPDATE product SET stock = ? WHERE id = ? ==> Parameters: 99(Integer), 2(Long) <== Updates: 1 ## updateSelective with nothing set -> has no content, the SQL is broken root cause: JdbcSQLSyntaxErrorException - Syntax error in SQL statement "UPDATE product\000a \000a [*]WHERE id = ?"; expected "., AS, SET"; SQL statement: ## insertAll -> one INSERT with two value tuples ==> Preparing: INSERT INTO product(name, price, stock, active, category_id) VALUES (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) ==> Parameters: A(String), 1.00(BigDecimal), 1(Integer), true(Boolean), 1(Long), B(String), 2.00(BigDecimal), 2(Integer), true(Boolean), 1(Long) <== Updates: 2 generated ids written back: [46, 47] ## ${q} with q = zzz' OR '1'='1' OR name LIKE ' ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p WHERE p.name LIKE '%zzz' OR '1'='1' OR name LIKE '%' ORDER BY p.id ==> Parameters: <== Total: 45 rows returned: 45 ## #{q} with q = zzz' OR '1'='1' OR name LIKE ' ==> Preparing: SELECT p.id, p.name, p.price, p.stock, p.active, p.category_id FROM product p WHERE p.name LIKE CONCAT('%', ?, '%') ORDER BY p.id ==> Parameters: zzz' OR '1'='1' OR name LIKE '(String) <== Total: 0 rows returned: 0