We want to formulate hibernate criteria query where we can escape & character.We are using Oracle database.
In oracle ampersand is the special character.For example , if Company is a db table and it has a column named company_name .There is every possibility that a company name can have &, like 'a&b Inc'. A hibernate criteria like this is not working.
Criterion criterion = Restrictions.eq("company_name", "a&b Inc").ignoreCase();
return cr.add(criterion);
When I execute this , although there are company name column values that matched "a&b Inc" it not returning any value.
I tried to look other answers in stack overflow , but didn't help me much.Please help me understand in how do this.
I referred to this Using hibernate criteria, is there a way to escape special characters? But didn't really understand on how to use it.Any example would be really helpful.