How to escape underscore in the string query in hibernate and SQL? How to escape underscore in the string query in hibernate and SQL? sql sql

How to escape underscore in the string query in hibernate and SQL?


Have you tried escaping it:

SELECT * FROM employee WHERE NAME LIKE '%k\_p%';

\_ instead of just _.


I know it is quite late but can be solution for other programmers.You can try

SELECT * FROM employee WHERE NAME LIKE '%k[_]p%';