Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
From OpenJPA manual:
"The query cache is enabled by default when the data cache is enabled. ...
When you run a query, OpenJPA assembles a key based on the query properties and the parameters used at execution time, and checks for a cached query result. If one is found, the object ids in the cached result are looked up, and the resultant persistence-capable objects are returned. Otherwise, the query is executed against the database, and the object ids loaded by the query are put into the cache."
Consider two queries Q1 and Q2 that only differ in their fetch plan F1 and F2. This implies QueryKey(Q1) = QueryKey(Q2) because QueryKey does not consider the fetch plan associated with a Query.
After Q1 is executed and its results cached, if Q2 is invoked, then OpenJPA considers it to be a cache hit and Q2 is not executed at all effectively ignoring F2.