Good day!
I'm using Oracle 10i database.
There are some rows in the table (Account) where Account_Name column data contains escape symbols. For example, 'SUB_'
Using HQL it is not a problem to search data with symbol '_', explicit ESCAPE definition will be used.
Code:
select account_name from account
where account_name like '%SUB\_' ESCAPE '\'
But when I use criteria based search, there is a problem.
Code:
criteria.add( Expression.like("account_name", "%SUB\_") );
The result query will look like the following:
Code:
select account_name from account
where account_name like '%SUB\_'
There is no explicit ESCAPE symbol definition, consequently the query returns incorrect data (in my case - empty result set).
So, the questions are:
1) Can I search data with escape symbols using Hibernate Criteria?
2) How can I do this?
Thanks in advance!