-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Dynamic projections in combination with Specifications and Pagination not working [DATAJPA-1189] #1524
Comments
Marcel Overdijk commented I created a PR for this here spring-projects/spring-data-examples#296 which contains 2 failing tests. This is related to https://jira.spring.io/browse/DATAJPA-393 and https://jira.spring.io/browse/DATAJPA-749 (I cannot link the issues) |
Marcel Overdijk commented Might be the same issue as https://jira.spring.io/browse/DATAJPA-1185 but good to check by adding tests for it |
Oliver Drotbohm commented Just as dynamic Querydsl predicates aren't supported with query methods, |
Marcel Overdijk commented OK thx for confirming |
Marcel Overdijk commented Would it be an idea to extend the That way we could use (dynamic) projections with both predicates and specifications. Don't know what this means technically.... |
Oliver Drotbohm commented That indeed is an option but one that ship with the downside of having to touch all these interfaces and implementations. I've been wondering whether we could rather plug support for predicates and specifications in a special query execution mode that rejects combined usages. I guess that's something for a bit of R&D time after Kay GA :) |
Marcel Overdijk commented (y) |
this9is3me commented Hi, any updates on this bug? Thank you |
Ruslan Stelmachenko commented
Maybe it is worth to add another interface for these methods to not create backward incompatibility. And maybe add a base interface that extends both old interface and new interface. Adding support for predicates and specifications in a special query execution mode is also a good thing that is worth to be implemented, but I think in majority of cases a couple of signatures like this is more than enough: <T> Page<T> findAll(@Nullable Specification<T> spec, Class<T> projection, Pageable pageable); (basically, all methods of current JpaSpecificationExecutor interface and similar methods of QuerydslPredicateExecutor interface) In most cases, if we already specified a predicate/specification and a projection, what else custom method parameters (except paging/sorting specifiers) would we want to specify?
By the way, it would be a very useful feature. Currently you could create methods with flexible predicates, or with flexible fields to select. But you couldn't combine these features. This makes zero-code approach impossible to be used in many cases and leads to necessity to create a custom implementation of such methods, that duplicates half of the spring-data |
Linking #2269 as that design could enable projections when using JPA specifications. |
As Ollie has described, this combination of features is simply not supported, so I'm closing this issue. |
Marcel Overdijk opened DATAJPA-1189 and commented
Dynamic Projections in combination with Specifications and/or Pagination is not working.
Calling these methods will throw a
Affects: 1.11.7 (Ingalls SR7)
Issue Links:
("is duplicated by")
("is duplicated by")
27 votes, 21 watchers
The text was updated successfully, but these errors were encountered: