Named parameter doesn't work with MySql LIKE statement
问题 I'm trying to organize a search function on the site, using the Spring-jdbc NamedParameterJdbcTemplate. public List<PhoneEntry> searchPhoneEntries(String search, String username) { String SQL = "select * from entries, users where users.enabled=true " + "and entries.username=:username " + "and concat(secondName, firstName, patronymic, mobile, tel, " + "address, entries.email) like ('%:search%')"; MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("username", username);