I am having problems with issuing a HQL search query which has a "like" clause in it...the database that i am using is MySQL 5.0
for example my HQL is something like
I have highlighted the areas due to which the error is coming up.. i get some errors saying that the '%' + ? + '%' cannot be recognised , and that it is not correct MySQL syntax,,, when i investigated, i found out that mysql does not allow concatenation of strings to be done with '+' ,,
then i did something like LIKE '%?%' , but that also didnt work ,,
would appreciate if some one call tell a possible workaround for this,, basically i want to get thru this SQL query which uses "like"
Thanks [ January 18, 2007: Message edited by: Mark Spritzler ]
since you have the query string posted we don't see the way it is constructed with your " and method calls, and while my method will work, it is still tough to determine when " in the variable assignment versus " in the query string sent to the database.
That is your query set to a string and escaping the double quotes where needed. I also took out you "?" and put in bind parameters instead. If you really had to use "?" which is a real pain to read and maintain, then take out the :bindName and replace it with ? do not put the ? with concatenating plus signs.