spring-projects / spring-projects/spring-data-relational

Add support for `Window` scrolling queries

Open
#1,605 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

Hi there,
originally I was working with Spring for GraphQL when I stumbled upon this problem:

I wanted to perform a query with a Reactive Repository returning a windowed result, but it would complain about a "non unique result". Most likely because the return type of the Repsitory method is Mono<Window<Book>> (I need the Window for GraphQL), but the query itself returns several rows.

interface BookRepository : ReactiveCrudRepository<Book, Long>, ReactiveQueryByExampleExecutor<Book> {

    fun findAllByOrderByName(example: Example<Book>, position: ScrollPosition): Mono<Window<Book>>

}

Am I missing something, or does Window not work in a Reactive context (yet)?

Find the attached source code with a Unit test to illustrate the problem.
reactive_window_query.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Unpack reactive_window_query.zip and run the included unit test to reproduce the non-unique-result error. Trace the reactive repository query used by the test and make the windowed result work for multiple rows with a Mono<Window> return type. Done means the test passes without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.