-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Pageable results and @Query annotation #1843
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
This regression seems to be caused by the backport of #1811 into the 4.1 branch where the processing of That this in version 4.2 works without an error comes from a previous change in 4.2 that cleaned up old code. I will add a fix to the 4.1 branch. What you could do with the current version: Change the return type of your repository method to: @Query("{\"match_phrase_prefix\":{\"stringValue\":\"?0\"}}")
SearchPage<MyDomainObj> findByStringPrefix(String stringValue, Pageable pageable); and then in your code work with the SearchPage<MyDomainObj> result = repository.findByStringPrefix("a ", Pageable.unpaged());
List<MyDomainObj> list = result.getContent().stream().map(SearchHit::getContent).collect(Collectors.toList()); |
As I understand the We have only a few points where whe use the Thanks |
If you define your method to return a |
Ok, this is clear. Thanks |
Spring Boot 2.4.6 and 2.4.7 broke compatibility between Page result type and @query annotation on same method.
A method with this signature used to work up to Spring Boot 2.4.5:
Starting from Spring Boot 2.4.6 whenever the code access to the objects inside the List a class cast exception is thrown.
See the attached test project.
The problem is shown with current setup. To replace it's behaviour with the previous version just replace Spring Boot version in pom.xml
demo.zip
The text was updated successfully, but these errors were encountered: