You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by ht...@apache.org on 2015/06/22 20:31:07 UTC
svn commit: r1686913 - in /openjpa/trunk: ./
openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
Author: hthomann
Date: Mon Jun 22 18:31:06 2015
New Revision: 1686913
URL: http://svn.apache.org/r1686913
Log:
OPENJPA-2539: Query Compilation causing inner join table to be randomly generated incorrectly - ported changes to trunk.
Modified:
openjpa/trunk/ (props changed)
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
Propchange: openjpa/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 22 18:31:06 2015
@@ -1,6 +1,6 @@
/openjpa/branches/1.0.x:736493
/openjpa/branches/2.0.x:1504611
-/openjpa/branches/2.1.x:1415379,1415398,1485010,1513249,1517838,1530146,1533218,1533280,1539188,1569528,1575444,1591536,1636464,1655218,1662610,1673300,1673491
-/openjpa/branches/2.2.1.x:1415367,1415413,1415425,1504719,1508186,1530347,1533222,1539193,1651808
-/openjpa/branches/2.2.x:1384400,1415459-1415460,1415469,1485013,1530364,1533223,1580898,1580939,1591681,1631786,1641906,1642555,1666312
+/openjpa/branches/2.1.x:1415379,1415398,1485010,1513249,1517838,1530146,1533218,1533280,1539188,1569528,1575444,1591536,1636464,1655218,1662610,1673300,1673491,1686894
+/openjpa/branches/2.2.1.x:1415367,1415413,1415425,1504719,1508186,1530347,1533222,1539193,1651808,1686910
+/openjpa/branches/2.2.x:1384400,1415459-1415460,1415469,1485013,1530364,1533223,1580898,1580939,1591681,1631786,1641906,1642555,1666312,1686911
/openjpa/branches/2.3.x:1533462,1535560,1536912,1540277,1564121
Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?rev=1686913&r1=1686912&r2=1686913&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Mon Jun 22 18:31:06 2015
@@ -632,9 +632,9 @@ public class QueryImpl
* Find the cached compilation for the current query, creating one if it
* does not exist.
*/
+ @SuppressWarnings("unchecked")
protected Compilation compilationFromCache() {
- Map compCache =
- _broker.getConfiguration().getQueryCompilationCacheInstance();
+ Map compCache = _broker.getConfiguration().getQueryCompilationCacheInstance();
if (compCache == null || !isParsedQuery()) {
return newCompilation();
} else {
@@ -648,17 +648,24 @@ public class QueryImpl
Compilation comp = (Compilation) compCache.get(key);
// parse declarations if needed
- boolean cache = false;
if (comp == null) {
comp = newCompilation();
// only cache those queries that can be compiled
- cache = comp.storeData != null;
- } else
+ if (comp.storeData != null) {
+
+ synchronized (compCache) {
+ Compilation existingComp = (Compilation) compCache.get(key);
+ if (existingComp == null) {
+ compCache.put(key, comp);
+ } else {
+ comp = existingComp;
+ }
+ }
+ }
+ } else {
_storeQuery.populateFromCompilation(comp.storeData);
+ }
- // cache parsed state if needed
- if (cache)
- compCache.put(key, comp);
return comp;
}
}