Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1599

Filtering of collections in controllers



    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core, Integration
    • Labels:


      I did some experiments with extending the QuerydslPredicateArgumentResolver to create a Predicate builder that supports fiql/odata like query options as e.g. ?name==Max*&age=gt=18.

      Many of the QuerydslPredicateArgumentResolver methods and it's used classes are not public so it's doesn't give much to extend it. Of course one could create a complete custom argument resolver and where necessary copy/paste needed stuff from Spring Data classes.

      It would be cool if Spring Data could support an out-of-the-box filter mechanism with operators being specified dynamically by the client.

      Note Apache CFX has some abstract search mechanism (http://cxf.apache.org/docs/jax-rs-search.html) which supports fiql and odata. Such a search mechanism could then be transformed to a JPA Specification or a Querydsl Predicate.
      Maybe it's worth to look if it would be possible to integrate/build something like that for Spring Data (Web).

      That being said one thing of importance here would be to support aliasing, to accept .e.g. full_name and actually use fullName in de db query. The QuerydslPredicateArgumentResolver already does this but e.g. the Pageable and Sort argument resolvers not yet for sorting.

      To be honest, I don't expect this issue to be simply picked up by the Spring Data team, but it's worth to discuss options and ideas here (as I think I'm probably not the only one who is looking into this direction).




            olivergierke Oliver Drotbohm
            marceloverdijk Marcel Overdijk
            Last updater:
            Jens Schauder
            0 Vote for this issue
            1 Start watching this issue