Skip to main content
PreparationZone Logo
PreparationZone
Back to AI Coding

AI Coding · Easy · Pro

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);
}