2021年1月3日星期日

Cannot put value into SQL Statement in Java Spring Boot

I have private static final String SQL_SEARCH_ALL = "SELECT * FROM product WHERE name LIKE '%?%'"; SQL statement, where I need to pass a query String. When instead of ? mark I pass a string like '%cola%' it works fine.

I pass paramater using JdbcTemplate as I have used to

return jdbcTemplate.query(SQL_SEARCH_ALL, new Object[]{searchInput}, productRowMapper);  

That returns zero objects.

I have problem with passing value into this statement.

https://stackoverflow.com/questions/65556820/cannot-put-value-into-sql-statement-in-java-spring-boot January 04, 2021 at 10:00AM

没有评论:

发表评论