-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Pageable Always Adding From Entity to Sort Field Name [DATAJPA-1332] #1655
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
Oliver Drotbohm commented Do you have an executable sample, that shows the problem? |
Vijay commented I don't have a separate sample just for this - but can create one if you feel this shouldn't be happening. I was wondering if aliases are supported in first places in pagination.
Do let me know, so that I can create a sample for you. Thanks |
Oliver Drotbohm commented They are. However, without you specifying what |
Vijay commented Hello again, I am creating an alias field, newDateDue (I have renamed the alias field name since it was probably confusing to have the same alias name as the field names) from two columns & I wanted to sort by this alias field newDateDue. Since it is an alias field, I can't specify either c,p or item. (The Use case is that one of item or p can have a dueDate and I want to combine the dueDate from the 2 tables and sort by the new aliased field newDueDate). My thinking is that if order by alias is possible without specifying table names (as in here https://coderanch.com/t/545957/databases/JPQL-SELECT-queries-field-aliases] then it probably is possible here too. Hope I am clear now. Thanks |
Vijay commented Hello, could you please guide on this. Thanks |
Vijay commented I resolved this through Criteria Queries - which are powerful, although tough to learn. Criteria Query cut through this (seemingly difficult query using spring data) like a knife through butter. Thanks |
Alexander commented Hi all! The issue is still valid for at least Spring Data Jpa 2.1.x, 2.2.x I've created a simple project to reproduce the problem - https://github.com/baranchikovaleks/data-jpa-sort |
I too am facing this exact same issue. It is tacking on the alias "f." of the main entity instead of first searching for alias names in the list of selects. This works if I use "cl.name" as a sort field, but fails if I use alias "clientName".
|
Looks like this issue will be resolved via #2863. |
If you check 39e12ea, you should see that aliasing is now properly handled in sorts, and that the query at the top is included as a test case. Feel free to check out Spring Data JPA |
Closing this as resolved by the earlier message. |
Vijay opened DATAJPA-1332 and commented
I am having the exact issue that is mentioned on this link https://jira.spring.io/browse/DATAJPA-726
It is mentioned as solved there, but I am getting the same issue, and a search on stackoverflow shows that the problem persists. I am using SpringBoot 1.5.12.
Basically, I am doing a pagination on JOIN query as follows
And my page request is
However, when i run this I keep getting the error
Evidently, it is searching for the sort field (i.e. newDateDue) in the Customer entity where it is not present.
So my question is
Thanks.
Note:There are other queries too on stackoverflow with similiar problems but no solutions. Links are as below
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: