-
Notifications
You must be signed in to change notification settings - Fork 1.5k
getFunctionAliases fails for complex query #2441
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
Comments
Please post the stack trace and method this SQL statement is annotated to? |
You can always implement it using a custom method implementation. We are looking in a proper solution for this kind of problem here #2417 |
Thank you for your response schaunder! This is the method from spring-data that I'm talking about:
It gets as input a String - query. If the query is somehow complex like in my initial post this method fails to match all function aliases. There is no stacktrace because there is no exception thrown. The problem is that the Looking at #2417 I think that using JSqlParser will be a proper solution for this. Regarding "custom method implementation" can you guide me to how can I achieve this? Any reference to a tutorial or documentation will be helpful. Thank you! |
I was referring to the method in your repository, that you applied the |
It is something like this:
|
Could you return a list instead, or provide a |
I've made a repo in order to explain better what I found to not work properly. There are 2 tests in the DemoApplicationTests class. In my opinion both of them should pass but they fail. You can find the repo here: https://github.com/TaridaGeorge/spring-data-jpa-issue-2441 |
The added test cases make sure the new implementation does not have the issue described in spring-projects#2441. Closes spring-projects#2441
Nice! Thank you! |
If I use the nativeQuery approach and I have a query like this:
the
getFunctionAliases
method fromorg/springframework/data/jpa/repository/query/QueryUtils.java
fails to takeinstitutesIds
as an alias and that's because that FUNCTION_PATTERN cannot handle complex cases like this.What should we do about it?
The text was updated successfully, but these errors were encountered: