Skip to content Skip to sidebar Skip to footer

Use Of Like Clause In Sql Prepared Statement, Spring, Simplejdbctemplate

I have the following sql prepared statement: SELECT * FROM video WHERE video_name LIKE ? Im using spring and jdbc. i have a method, where term is a searchterm, sjt is a SimpleJdbc

Solution 1:

You need to put the % around the value itself, not around the placeholder (the question mark).

So:

return sjt.query(searchForTermQuery, newVideoMapper(), "%" + term + "%");

Post a Comment for "Use Of Like Clause In Sql Prepared Statement, Spring, Simplejdbctemplate"