-
Notifications
You must be signed in to change notification settings - Fork 100
Missing Pageable Sort interpretation #379
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
While it doesn't mean it has to stay this way, this seems to be intentional and somewhat in accordance to the relevant JavaDoc on
I guess the original idea was that sorting revisions by anything but timeline is of limited use. Could you explain your use case of sorting by something else but the revision number? |
Thank you very much for your answer. We have a distributed service that performs update operations for entities and updates a modified timestamp each time. We have encountered a problem when we use a cached sequence with an increment of 50 (to increase performance for large amounts of data). When multiple instances make updates to an entity, the temporal order is not guaranteed when using such a cache, so sorting by the modified timestamp of the revisioned entities seemed to be straight forward. var orderMapped = pageable.getSort().stream().findFirst().map(order ->
order.getDirection().isAscending() ?
AuditEntity.property(order.getProperty()).asc() :
AuditEntity.property(order.getProperty()).desc())
.orElse(AuditEntity.revisionNumber().asc()); But perhapse this can be adapted to enhance this great project. |
Yes, that does make sense and sounds like an improvement. A PR would be appreciated. |
Closes spring-projects/spring-data-envers#379 Original Pull Request spring-projects/spring-data-envers#381
Closes spring-projects/spring-data-envers#379 Original Pull Request spring-projects/spring-data-envers#381
Currently you cannot sort by property only the sort direction is interpretated as the revision number.
spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java
Line 147 in 2196536
The text was updated successfully, but these errors were encountered: