-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Pageable.Sort problem in Spring Boot 2.6.7 and Spring Boot 2.5.13 #30867
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
@fuxao This appears to be a Spring Data JPA problem, possibly related to spring-projects/spring-data-jpa#2260. It's difficult to verify with your sample because it does not include a failing test that reproduces the problem. Spring Boot
Can you try this and see if it works around your problem? |
@scottfrederick You are right. Everything is OK with the properties setting After reading spring-projects/spring-data-jpa#2260 I think that it describes the same problem. I also updated the example project and now there is one failing test that reproduces the problem. By default the properties setting for
If you uncomment this properties setting, everything is OK.
|
Thanks very much for following up @fuxao. I'll close this issue as a duplicate of the Spring Data JPA issue. It looks like you should see the fix in the next round of Spring Data releases and the Spring Boot releases that follow. |
@xuekvm You can learn how to do it with Gradle in the plugin's documentation. If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. |
Description of Pageable.Sort problem
Introduction
I have a controller where
@SortDefault
is used.There are 2 separate entities without connection. There is a query in
DocumentRepository
(JpaRepository) in which both entities are used.In real application this query is much more complicated, I simplify this query for example application.
Problem report
Before Spring Boot 2.6.7 and 2.5.13 this query generated this SQL statement.
As you can see the sql statement ends with
order by documenten0_.updated
. This is expected behaviour. After upgrading to Spring Boot 2.6.7 or 2.5.13 QuerySyntaxException is thrown instead.As you can see the problem is that the query ends with
order by machine.updated
. This is not OK. Incorrectly machine entity is used.Example project
I attach maven project (as simple as possible) in which the problem can be debug.
pageable-sort-problem.zip
You can see in
pom.xml
tested spring boot versions and the results of my tests.The text was updated successfully, but these errors were encountered: