I'm trying to use a named parameter but when I have them inside of single quotation marks they don't get replaced for the query and it returns 0 results. How do I use my parameter inside the single quotation marks?
protected static final String SQL_QUERY =
" SELECT * \n" +
" FROM example \n" +
" WHERE UPPER(name) LIKE UPPER('%:query%') \n";
@Autowired
private NamedParameterJdbcTemplate template;
public List<Item> getResultFromQuery(String query) throws Exception {
return (List<Item>) template.query(SQL_QUERY,
new MapSqlParameterSource().addValue("query", query), resultSetExtractor);
}