Currently using eclipselink JPA provider for accessing backend entities. I'm using namedqueries for accessing data and using the below options on query caching.
@NamedQueries({
@NamedQuery(name = Supplier.FIND_ALL, query = "select o from Supplier o",hints={
@QueryHint(name=QueryHints.READ_ONLY, value=HintValues.TRUE),
@QueryHint(name = QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE),
@QueryHint(name = QueryHints.CACHE_STATMENT, value = HintValues.TRUE),
@QueryHint(name = QueryHints.CACHE_STORE_MODE, value = "REFRESH"),
@QueryHint(name = QueryHints.CACHE_RETRIEVE_MODE,value=CacheUsage.CheckCacheThenDatabase),
}),
})
Also i'm using the below Cache options on the entity as well.
@Cache(refreshOnlyIfNewer=true,
coordinationType=CacheCoordinationType.SEND_OBJECT_CHANGES,alwaysRefresh=true)
The query seems to be taking sometime for the first time, but is pretty fast for further retrievals ( b'cozs of QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE
). But it seems any changes to the database subsequently, are not getting reflected in the output. It seems the cache is not getting refreshed and updated changes to the database are not reflected in the output.
Require help on the same.
Thanks, Krishna