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

Support for projections in repository query methods

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.12 M1 (Hopper)
    • Component/s: None
    • Labels:
      None
    • Sprint:
      57 - Fowler Aftermath, 58 - Gosling M1, 59 - Evans / Fowler SR, Gosling RC1, Hopper M1

      Description

      The findBy clause of the derived queries currently allows setting a distinct flag already. We could add property projections as well:

      interface PersonRepository extends Repository<Person, Long> {
      
        List<Map<String, String>> findNameAndAgeByGroupTitle(String title);
      }
      

      The return types should act as follows:

      • Map<String, ${type or Object}> expecting a single returned result consisting of multiple key-value pairs.
      • ${type} - expecting a single result. We'll trigger a DTO projection, e.g. select new ${type}(name, age) ...
      • Iterable of both possibilities triggering the very same expecting multiple results
      • Page of both triggering pagination.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olivergierke Oliver Gierke
                Reporter:
                mhunger Michael Hunger
                Last updater:
                Oliver Gierke
              • Votes:
                19 Vote for this issue
                Watchers:
                17 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: