PrepZone Logo
PrepZone
Back to AI Coding

AI Coding · Easy

The assistant wrote a search repository method. Find the problem.

AI CodingCode ReviewSenior
java
public List<Product> search(String name, String sortBy) {
    String sql = "SELECT * FROM products WHERE name LIKE '%" + name + "%'"
               + " ORDER BY " + sortBy;
    return jdbcTemplate.query(sql, productRowMapper);
}