wrong SQL generated on Oracle when using like
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Querydsl |
Fix Released
|
Medium
|
Timo Westkämper |
Bug Description
I have a Person with multiple addresses. When searching a Person living in a street starting with SomeValue_, the query becomes:
select *
from PERSON person
join ADDRESS address
on address.PERSON = person.ID
where address.STREET like 'SomeValue\_%'
(note the backslash)
Apparently, the backslash character is a default escape character for most databases. Oracle, however does not have this, so the query should read:
select *
from PERSON person
join ADDRESS address
on address.PERSON = person.ID
where address.STREET like 'SomeValue\_%' escape '\'
IMHO the OracleTemplates class should override the STARTS_WITH, ENDS_WITH and STRING_CONTAINS operations like this:
templates.
templates.
templates.
The same applies for the like - ignoreCase templates.
It should also be possible to configure this escape character. Right now, this is hardcoded in the StringEscape class. IMHO this should be provided by the appropriate SqlTemplates implementation.
Thanks.
I fixed the Oracle like templates in SVN trunk. I am still trying to figure out the best way to make the escape character configurable.