rzo1 commented on code in PR #272:
URL: https://github.com/apache/openjpa/pull/272#discussion_r4484078096


##########
openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryResultCacheImpl.java:
##########
@@ -88,11 +89,17 @@ public void evictAll(Class cls) {
      */
     private QueryKey toQueryKey(Query q) {
         QueryImpl impl = (QueryImpl) q;
-        if (impl.hasPositionalParameters())
-            return QueryKey.newInstance(impl.getDelegate(),
-                impl.getPositionalParameters());
-        return QueryKey.newInstance(impl.getDelegate(),
-            impl.getNamedParameters());
+        // use the values the query is executed with (a Calendar bound with a 
TemporalType
+        // is converted on execution), so that the key matches the key the 
result is cached under
+        Map<Object, Object> values = impl.getParameterValues();
+        if (impl.hasPositionalParameters()) {
+            Object[] params = impl.getPositionalParameters();
+            for (Map.Entry<Object, Object> e : values.entrySet())
+                if (e.getKey() instanceof Integer)

Review Comment:
   Thanks, done (added braces too).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to