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

SQL Syntax Error at (:foo) #823

Closed
2 of 4 tasks
yasarutkuu opened this issue Nov 24, 2020 · 0 comments
Closed
2 of 4 tasks

SQL Syntax Error at (:foo) #823

yasarutkuu opened this issue Nov 24, 2020 · 0 comments

Comments

@yasarutkuu
Copy link
Contributor

yasarutkuu commented Nov 24, 2020

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

@Query("SELECT * FROM person WHERE name = :names1 or name IN(:names3) or name IN(:names0) or (:name4 = name)")
List<Person> queryNames(List<String> names0, String names1, List<String> names2, List<String> names3, String name4);

Above query doesn't work because of the (:name4 part.
We also added this query as a test in this relevant PR.

Expected Behaviour

Query should successfully run as expected.

Actual Behaviour

Throws an sql syntax error.

Pattern VARIABLE_PATTERN = Pattern.compile("[^:](:([a-zA-Z0-9]+))");
The above pattern matches the character just before : and later we replace the pattern with:
query = matcher.replaceAll(" ?");
Therefore destroying the pattern.

Environment Information

Example Application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants