spring-projects / spring-projects/spring-data-jpa
How to JpaSpecificationExecutor and @QueryHints [DATAJPA-1637]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
cancel opened DATAJPA-1637 and commented
Hello, im use JpaSpecificationExecutor. How i can cache these query with hibernate second level cache. @QueryHints does not work
@Override
@QueryHints(value = { @QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true")})
public Optional<ControlType> findByIdAndOrganization(Long id, Organization organization) {
return controlTypeRepository.findOne(spec.byId(id).and(spec.byOrganization(organization)));
}
Affects: 2.1.13 (Lovelace SR13)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported JpaSpecificationExecutor.findOne call and the @QueryHints usage shown in the issue, then check how Hibernate second-level query caching is configured for the affected 2.1.13 version. Reproduce whether CACHEABLE is applied to the specification query; done means identifying the supported behavior or documenting a confirmed fix with a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100