diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java index cd0106a92..246bdab0b 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java @@ -262,6 +262,10 @@ public class QueryCacheStoreQuery return _query.newCompilation(); } + public Object getCompilation() { + return _query.getCompilation(); + } + public void populateFromCompilation(Object comp) { _query.populateFromCompilation(comp); } @@ -331,7 +335,7 @@ public class QueryCacheStoreQuery public ResultObjectProvider executeQuery(StoreQuery q, Object[] params, Range range) { QueryCacheStoreQuery cq = (QueryCacheStoreQuery) q; - Object parsed = cq.getDelegate().newCompilation(); + Object parsed = cq.getDelegate().getCompilation(); QueryKey key = QueryKey.newInstance(cq.getContext(), _ex.isPacking(q), params, _candidate, _subs, range.start, range.end, parsed); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java index 8b34f9e1e..0ca64e3cf 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java @@ -72,6 +72,10 @@ public abstract class AbstractStoreQuery return null; } + public Object getCompilation() { + return null; + } + public void populateFromCompilation(Object comp) { } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java index 8d41cc940..3ce68c31d 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ExpressionStoreQuery.java @@ -154,6 +154,10 @@ public class ExpressionStoreQuery return _parser.parse(ctx.getQueryString(), this); } + public Object getCompilation() { + return _parsed; + } + public void populateFromCompilation(Object comp) { _parser.populate(comp, this); } diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreQuery.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreQuery.java index 00594ae86..204d6a331 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreQuery.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StoreQuery.java @@ -90,6 +90,11 @@ public interface StoreQuery * Create a new compilation for this query. May be null. */ public Object newCompilation(); + + /** + * Get the current compilation for this query. If it is null, do not create. + */ + public Object getCompilation(); /** * Populate internal data from compilation.