cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [1/2] cayenne git commit: CAY-1979 | fix Prefetches on Many-to-Many Relationships with Longvarchar
Date Tue, 23 Dec 2014 13:45:13 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-3.1 62affba37 -> 0e5f8b76d


CAY-1979 | fix Prefetches on Many-to-Many Relationships with Longvarchar


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

Branch: refs/heads/STABLE-3.1
Commit: f973c36a02874c4b908024f9bdd7217621af6292
Parents: 62affba
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Fri Dec 19 17:16:52 2014 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Fri Dec 19 17:16:52 2014 +0300

----------------------------------------------------------------------
 .../cayenne/access/trans/SelectTranslator.java  | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/f973c36a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
----------------------------------------------------------------------
diff --git a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
index d3543df..a7ac55e 100644
--- a/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
+++ b/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/trans/SelectTranslator.java
@@ -19,16 +19,6 @@
 
 package org.apache.cayenne.access.trans;
 
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.access.jdbc.ColumnDescriptor;
 import org.apache.cayenne.dba.QuotingStrategy;
@@ -55,6 +45,16 @@ import org.apache.cayenne.util.CayenneMapEntry;
 import org.apache.cayenne.util.EqualsBuilder;
 import org.apache.cayenne.util.HashCodeBuilder;
 
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * A builder of JDBC PreparedStatements based on Cayenne SelectQueries. Translates
  * SelectQuery to parameterized SQL string and wraps it in a PreparedStatement.
@@ -416,8 +416,14 @@ public class SelectTranslator extends QueryAssembler {
                         .resolvePath(pathExp, getPathAliases())) {
 
                     if (component.getRelationship() != null) {
-                        dbRelationshipAdded(component.getRelationship(), component
-                                .getJoinType(), null);
+                        // do not invoke dbRelationshipAdded(), invoke
+                        // pushJoin() instead. This is to prevent
+                        // 'forcingDistinct' flipping to true, that will result
+                        // in unneeded extra processing and sometimes in invalid
+                        // results (see CAY-1979). Distinctness of each row is
+                        // guaranteed by the prefetch query semantics - we
+                        // include target ID in the result columns
+                        getJoinStack().pushJoin(component.getRelationship(), component.getJoinType(),
null);
                     }
 
                     lastComponent = component;


Mime
View raw message