spring-projects / spring-projects/spring-data-jpa

Query hint parameters in JpaSpecificationExecutor [DATAJPA-144]

Open
#569 6 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
3.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Anssi Törmä opened DATAJPA-144 and commented

The Specification pattern is useful when complex specifications are combined from simple ones. However, query performance becomes an issue. Possibility to pass query hints to methods of JpaSpecificationExecutor would be very useful. That is, I would like something along these lines

JpaSpecificationExecutor.findAll(Specification<T>, List<QueryHint>)
JpaSpecificationExecutor.findAll(Specification<T>, Sort, List<QueryHint>)
…

where QueryHint is a name-value pair. Note that it must be possible to pass multiple hint values with the same name. For example "eclipselink.batch" -> "org.manager", "eclipselink.batch" -> "org.employees".

As a workaround, I've had to create my own JpaSpecificationExecutor with such methods using the source code in SimpleJpaRepository


7 votes, 6 watchers

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

Start by comparing JpaSpecificationExecutor with the existing implementation in SimpleJpaRepository and identify the specification-query methods affected by the requested overloads. Check how the API could accept multiple query hints with the same name; done means the requested query paths support the hint parameters described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend-api-design, 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.