I'm working on a Java Spring project. This project uses redisson-hibernate-53 cache and I'm able to cache entities by using this annotation @Cache
; however, I'm not sure how to set queries to be cached knowing that I use Spring JpaRepository and I write my queries as follows:
@QueryHints(value = {@QueryHint(name = "org.hibernate.cacheable", value = "true")
, @QueryHint(name = "org.hibernate.cacheRegion", value = "FindByNameRegion") })
List<Employee> findByJobRole(String jobRole);
I added this property :
spring.jpa.properties.hibernate.cache.use_query_cache=true
But I think I'm missing some other configuration. Any help is appreciated!
The problem is the Redis server on Windows is not stable ,however the exact configurations will work fine on other OS like linux.