cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2472 Clear cached replacement query on mutation in all indirect queries
Date Wed, 05 Sep 2018 12:17:42 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 643a889b5 -> 4fd50392e


CAY-2472 Clear cached replacement query on mutation in all indirect queries


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/4fd50392
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/4fd50392
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/4fd50392

Branch: refs/heads/master
Commit: 4fd50392e74a90f781d55d23354d4eca5a63fd64
Parents: 643a889
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Wed Sep 5 15:17:33 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Wed Sep 5 15:17:33 2018 +0300

----------------------------------------------------------------------
 RELEASE-NOTES.txt                                    |  1 +
 .../java/org/apache/cayenne/query/ColumnSelect.java  | 15 ++++++++++++---
 .../java/org/apache/cayenne/query/ObjectSelect.java  | 11 ++++++++++-
 .../java/org/apache/cayenne/query/SQLSelect.java     | 13 +++++--------
 4 files changed, 28 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/4fd50392/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 171a277..f3233e5 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -32,6 +32,7 @@ CAY-2462 Modeler: Clipboard holds old content after application was reloaded
 CAY-2463 Modeler: DB Schema generation doesn't work
 CAY-2464 ClassCastException when returning PRUNED_NODE in expression transformer
 CAY-2470 Can't bind SQLExec parameters in a loop
+CAY-2472 Clear cached replacement query on mutation in all indirect queries
 
 ----------------------------------
 Release: 4.1.M2

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4fd50392/cayenne-server/src/main/java/org/apache/cayenne/query/ColumnSelect.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/ColumnSelect.java b/cayenne-server/src/main/java/org/apache/cayenne/query/ColumnSelect.java
index ca9db48..f72fc85 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/ColumnSelect.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/ColumnSelect.java
@@ -142,7 +142,8 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         this.entityType = entityType;
         this.entityName = entityName;
         this.dbEntityName = dbEntityName;
-        return (ColumnSelect<T>)this;
+        this.replacementQuery = null;
+        return this;
     }
 
     /**
@@ -232,7 +233,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         }
 
         Collections.addAll(this.orderings, orderings);
-
+        replacementQuery = null;
         return this;
     }
 
@@ -252,7 +253,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         }
 
         this.orderings.addAll(orderings);
-
+        replacementQuery = null;
         return this;
     }
 
@@ -272,6 +273,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         }
 
         prefetches.merge(prefetch);
+        replacementQuery = null;
         return this;
     }
 
@@ -292,6 +294,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         }
 
         prefetches.addPath(path).setSemantics(semantics);
+        replacementQuery = null;
         return this;
     }
 
@@ -448,6 +451,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         columns.add(firstProperty);
         Collections.addAll(columns, otherProperties);
         singleColumn = false;
+        replacementQuery = null;
         return (ColumnSelect<Object[]>)this;
     }
 
@@ -474,6 +478,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
 
         columns.addAll(properties);
         singleColumn = false;
+        replacementQuery = null;
         return (ColumnSelect<Object[]>)this;
     }
 
@@ -485,6 +490,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
             this.columns.clear(); // if we don't clear then return type will be incorrect
         }
         this.columns.add(property);
+        this.replacementQuery = null;
         return (ColumnSelect<E>) this;
     }
 
@@ -616,6 +622,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
     public ColumnSelect<T> distinct() {
         this.suppressDistinct = false;
         this.distinct = true;
+        this.replacementQuery = null;
         return this;
     }
 
@@ -625,6 +632,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
     public ColumnSelect<T> suppressDistinct() {
         this.suppressDistinct = true;
         this.distinct = false;
+        this.replacementQuery = null;
         return this;
     }
 
@@ -634,6 +642,7 @@ public class ColumnSelect<T> extends FluentSelect<T> {
         } else {
             where = exp;
         }
+        replacementQuery = null;
     }
 
     private Expression getActiveExpression() {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4fd50392/cayenne-server/src/main/java/org/apache/cayenne/query/ObjectSelect.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/ObjectSelect.java b/cayenne-server/src/main/java/org/apache/cayenne/query/ObjectSelect.java
index a37cf37..f5e3c99 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/ObjectSelect.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/ObjectSelect.java
@@ -255,6 +255,7 @@ public class ObjectSelect<T> extends FluentSelect<T> {
         }
 
         where = ExpressionFactory.and(all);
+        replacementQuery = null;
         return this;
     }
 
@@ -292,6 +293,7 @@ public class ObjectSelect<T> extends FluentSelect<T> {
         }
 
         where = ExpressionFactory.or(all);
+        replacementQuery = null;
         return this;
     }
 
@@ -334,6 +336,7 @@ public class ObjectSelect<T> extends FluentSelect<T> {
         }
 
         Collections.addAll(this.orderings, orderings);
+        replacementQuery = null;
 
         return this;
     }
@@ -354,6 +357,7 @@ public class ObjectSelect<T> extends FluentSelect<T> {
         }
 
         this.orderings.addAll(orderings);
+        replacementQuery = null;
 
         return this;
     }
@@ -374,6 +378,7 @@ public class ObjectSelect<T> extends FluentSelect<T> {
         }
 
         prefetches.merge(prefetch);
+        replacementQuery = null;
         return this;
     }
 
@@ -394,6 +399,7 @@ public class ObjectSelect<T> extends FluentSelect<T> {
         }
 
         prefetches.addPath(path).setSemantics(semantics);
+        replacementQuery = null;
         return this;
     }
 
@@ -533,7 +539,10 @@ public class ObjectSelect<T> extends FluentSelect<T> {
      */
     @SuppressWarnings("unchecked")
     public ObjectSelect<DataRow> fetchDataRows() {
-        this.fetchingDataRows = true;
+        if(!fetchingDataRows) {
+            fetchingDataRows = true;
+            replacementQuery = null;
+        }
         return (ObjectSelect<DataRow>) this;
     }
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/4fd50392/cayenne-server/src/main/java/org/apache/cayenne/query/SQLSelect.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/query/SQLSelect.java b/cayenne-server/src/main/java/org/apache/cayenne/query/SQLSelect.java
index 2bd0943..a21505d 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/query/SQLSelect.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/query/SQLSelect.java
@@ -173,17 +173,14 @@ public class SQLSelect<T> extends IndirectQuery implements Select<T>
{
 
 	@SuppressWarnings({ "rawtypes", "unchecked" })
 	public SQLSelect<T> params(Map<String, ?> parameters) {
-
 		if (this.params == null) {
 			this.params = new HashMap<>(parameters);
 		} else {
 			this.params.putAll(parameters);
 		}
-
 		this.replacementQuery = null;
 
-		// since named parameters are specified, resetting positional
-		// parameters
+		// since named parameters are specified, resetting positional parameters
 		this.positionalParams = null;
 		return this;
 	}
@@ -215,11 +212,11 @@ public class SQLSelect<T> extends IndirectQuery implements Select<T>
{
 	 * parameters.
 	 */
 	public SQLSelect<T> paramsList(List<Object> params) {
-		// since named parameters are specified, resetting positional
-		// parameters
-		this.params = null;
-
 		this.positionalParams = params;
+		this.replacementQuery = null;
+
+		// since named parameters are specified, resetting positional parameters
+		this.params = null;
 		return this;
 	}
 


Mime
View raw message