Can any one please help to escape from NOT(!) symbol in HQL. I am using Postgres 8.3. Also I am unable to search with these chars |\?'( )
fts('english',COLUMN_NAME,'" + searchText + "') = true)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should be binding the search text instead of concatenating it manually to the query. Not only does it fixes your problem, it’s also better in terms of security (SQL injection) and performance (the database sees the same query with different parameters, which allows it to cache the compiled query when it can).
Change your query so it looks like:
You can then properly bind your parameters:
It’s the same principle as using a
PreparedStatementwith JDBC and setting the parameters (the main difference being that the parameters’ indices start at 1 with JDBC and 0 with HQL).