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

Support random parameter in query derivation.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9 GA (Evans)
    • Fix Version/s: None
    • Component/s: Repositories

      Description

      Often projects need to be able to select a random resource (Image, New Entry, etc.) from a data store for display. This is often achieved by sending a query to a data store whilst sorting by a random value and limiting the result size to 1.

      I wonder whether we could offer something like this:

      interface ImageRepository extends CrudRepository<Image, Long>{
         Image findFirstOrderByRandom();
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              thomasd Thomas Darimont
              Last updater:
              Mark Paluch
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: