Skip to content

Add EntityGraphHint query method parameter#4285

Open
yeomin4242 wants to merge 1 commit into
spring-projects:mainfrom
yeomin4242:gh-4175-entity-graph-parameter
Open

Add EntityGraphHint query method parameter#4285
yeomin4242 wants to merge 1 commit into
spring-projects:mainfrom
yeomin4242:gh-4175-entity-graph-parameter

Conversation

@yeomin4242

Copy link
Copy Markdown

Repository query methods can now accept EntityGraphHint to select an entity graph per invocation.

The hint can be created from type-safe property paths, named entity graphs, or a JPA EntityGraph instance. We treat the hint as a special parameter so it is excluded from query binding and apply it for runtime and AOT query creation. If the argument is null, query creation falls back to the declared @EntityGraph metadata.

Includes unit and integration tests for parameter discovery, runtime query creation, repository execution, and AOT query generation.

Closes #4175

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 16, 2026
@yeomin4242 yeomin4242 force-pushed the gh-4175-entity-graph-parameter branch from 3d4594c to 89181cd Compare June 16, 2026 10:57
Repository query methods can now accept EntityGraphHint to choose an entity graph per invocation from typed property paths, named entity graphs, or a JPA EntityGraph instance. The hint is treated as a special parameter and applied by runtime and AOT query creation.

Closes spring-projects#4175
Signed-off-by: YeongJae Min <whereismysejong@naver.com>
@yeomin4242 yeomin4242 force-pushed the gh-4175-entity-graph-parameter branch from 89181cd to 8788976 Compare June 16, 2026 11:59
@yeomin4242 yeomin4242 marked this pull request as ready for review June 17, 2026 06:25
@mp911de mp911de self-assigned this Jun 29, 2026
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider EntityGraph argument for query methods

3 participants