-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Pageable Always Adding From Entity to Sort Field Name [DATAJPA-726] #1066
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 That should be fixed. We now inspect all kinds of joins for aliases |
Oliver Drotbohm commented I just realized that the better way of defining the sort would be |
Corey Mosher commented Good to know. I tried the example using 1.7.3 snapshot and the problem seems to be gone, so once 1.7.3 goes to release and it's picked up by spring boot, it should resolve the issue for me |
Oliver Drotbohm commented That's great to hear. Be advised that you can always trick Boot into newer versions of Spring Data by setting |
I still have this problem. I'm using spring-core 5.3.22 and spring-data-jpa 2.7.2. What versions of each do I need to have the fix? |
Would be cool if you could provide us with a minimal reproducer and create a new ticket for that. |
@Dawood-ibn-Kareem Please follow #2960 and you can track our progress on resolving this issue. Pay note, that while that ticket is assigned to Spring Data JPA 3.2, the solution will certainly be backported to 3.1. However, it's unlikely to be backported to 2.7, considering we don't have the newly built HQL/JPQL parser available, and such detailed operations are very difficult with the old QueryUtils. |
Corey Mosher opened DATAJPA-726 and commented
When using
@Query
in a JPA repository along withPageable
and attempting to sort on a field in a joined entity, the from entity gets prepended to the sort field. For example, if I do the following query:If I pass a
PageRequest
sorting on a field in the from entity (Customer
), everything will work fine:However, if I simply decide to sort by a field in the
ProductOrder
entity with thisPageRequest
:I will get the following error:
c.
was prepended onto the sort field. I am attaching a modified version of the Spring Data JPA tutorial from the Spring site that illustrates the issueAttachments:
Referenced from: commits 51a8885, baae6c7, 28ac667, 67b93c2
Backported to: 1.8.1 (Fowler SR1), 1.7.3 (Evans SR3), 1.6.6 (Dijkstra SR6)
The text was updated successfully, but these errors were encountered: