Specification<T>.toPredicate(...) Change type of first parameter to From<?, T> #2761
Labels
status: pending-design-work
Needs design work before any code can be developed
type: enhancement
A general enhancement
Dear spring devs,
I'd like to suggest the following change in interface
Specification<T>
:Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder);
to
Predicate toPredicate(From<?, T> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder);
Because
From<T, U>
is the supertype of bothRoot<T>
andJoin<T, U>
, it would allow better reuse of specifications when joining tables.Our use case is the following, we have a OneToMany relation
Table CarMaker <>---> Table Car
We have already made Specification factory methods from Request DTOs for entities
CarMaker
andCar
.We would like to reuse these 2 methods when filtering on both CarMaker and Car:
see also: https://stackoverflow.com/a/46955740/6705221
The text was updated successfully, but these errors were encountered: