Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape character in LIKE expressions is not escaped by querydsl #438

Closed
LordOfTheHelmet opened this issue Jun 11, 2013 · 3 comments
Closed

Escape character in LIKE expressions is not escaped by querydsl #438

LordOfTheHelmet opened this issue Jun 11, 2013 · 3 comments
Milestone

Comments

@LordOfTheHelmet
Copy link

@LordOfTheHelmet LordOfTheHelmet commented Jun 11, 2013

To reproduce this:

BooleanExpression patternPredicate = company.name.toLowerCase().like("%My! Text%");

When i execute this i get the exception:

java.sql.SQLDataException: ORA-01424: Zeichen nach dem Escape-Zeichen fehlen oder sind ungültig

The SQL generated from the expression looks like:

lower(company0_.NAME) like ? escape '!'

and the bound value is:

TRACE org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:84) - binding parameter [1] as [VARCHAR] - %My! Text%

Shouldn't querydsl escape the escape character for me? Otherwise i have to do something like:

BooleanExpression patternPredicate = company.name.toLowerCase().like("%My! Text%".replaceAll("!", "!!"), '!');
@timowest
Copy link
Member

@timowest timowest commented Jun 11, 2013

That would also mean that actual escaping is only available when the other like variants are used.

str.like("\\%")

would need to be written as

str.like("\\%", '\\')

But maybe this makes sense, since it makes escaping more explicit.

@timowest
Copy link
Member

@timowest timowest commented Jun 26, 2013

Released in 3.2.1

@timowest timowest closed this Jun 26, 2013
@LordOfTheHelmet
Copy link
Author

@LordOfTheHelmet LordOfTheHelmet commented Jun 27, 2013

Thanks for accepting and implementing it!

@timowest timowest added this to the 3.2.1 milestone Apr 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.