Open spring-projects-issues opened 9 years ago
Dennis Laumen commented
Has there been any progress on this? Or some kind of workaround? If I understand the above correctly I'm having the same issue as described in this StackOverflow question
David Welch commented
Just to weigh in, I've had the same experience for similar requirements. Making the classes extensible and/or configurable would be desirable
Petar Tahchiev commented
+1 for this. We also have the same problem - ended up copying the whole QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver
class in our project
chris marx commented
Is this also the same reason that querying on related entities that are one-to-many is also failing? - https://stackoverflow.com/questions/35181167/spring-data-rests-querydsl-integration-for-quering-subproperties-of-collection
and this one?
http://stackoverflow.com/questions/35918824/spring-querydslpredicate-questions
Eric Turley commented
I think it might solve this, too: https://stackoverflow.com/questions/45989336/querydsl-web-query-on-the-key-of-a-map-field
To work around that issue, I programatically destroy the repoRequestArgumentResolver
bean and register my own copy-paste monstrosity of the QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver
Vladimir Tsanev opened DATAREST-694 and commented
Use case that we have, has following requirements:
/\{repository\}/something
endpoints can specify filters with?property=value
.Spring Data defines a strategy interface for resolving QueryDsl entity paths -
EntityPathResolver
. We want to provide our own implementation to be used by spring data jpa/rest, based onPathBuilder
instead of the generated query classes.However currently it is a painful experience to meet to above requirements. Here are some of the problems we met and some suggestions for improvements.
EntityPathResolver
provided byQuerydslBindingsFactory
is not actually used when creating instances ofQueryDslJpaRepository
, but a hard-coded reference toSimpleEntityPathResolver.INSTANCE
JpaRepositoryFactory
andQuerydslBindingsFactory
was easier.QueryPredicateBuilder
(wrongly?) assumes thatPath
instances returned by the resolver are instances of generated querydsl classes (seereifyPath
).QueryPredicateBuilder
, butQueryPredicateBuilder
is a class that and cannot be easily extended. We also want to be able to wrap it to provide alternative chained implementations.QueryPredicateBuilder
, one should extendRepositoryRestMvcConfiguration
and overriderepoRequestArgumentResolver()
.QuerydslAwareRootResourceInformationHandlerMethodArgumentResolver
is package private, and we need to copy paste it in order to instantiate it in our configuration!Maybe having
QuerydslPredicateBuilder
as a bean likeQuerydslBindingsFactory
would be better, extendingRepositoryRestMvcConfiguration
is something that we want to avoid because it disables spring boot's auto configuration.Affects: 2.4 GA (Gosling)
8 votes, 9 watchers