4

I'm using Mysql database. I got stored data for certain columns with value of a\"a. I used following query to select but it failed:

select * from table_name where coloum_name like "%a\"%";

I spend some hours to find a query to select and the following one is working:

select * from table_name where coloum_name like "%a\\\\\\\\""%";

I'm using hibernate in my application, so I used:

criteria.add(Restrictions.ilike("coloum_name","%a\\\\\\\\""%"));

but it's not working. Any possible way to select via criteria??

bish
  • 3,381
  • 9
  • 48
  • 69
  • Check this out thoroughly http://stackoverflow.com/questions/673508/using-hibernate-criteria-is-there-a-way-to-escape-special-characters – jsedano Apr 22 '13 at 14:35
  • Thanks for response anakata. I already checked, but not suitable for me. i'm having '\"' char in column which i want to search. – Muthuramu Periyaiah Apr 22 '13 at 14:40
  • Check this http://stackoverflow.com/questions/4097161/hibernate-criteria-api-select-in – Navand Apr 22 '13 at 15:11

1 Answers1

0

Check this one. Hope this will help for you. http://levanhuy.wordpress.com/2009/02/19/providing-an-escape-sequence-for-criteria-queries/

Nithish
  • 103
  • 1
  • 6