cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [2/2] cayenne git commit: CAY-1979 | fix prefetches on Many-to-Many Relationships with Longvarchar
Date Thu, 18 Dec 2014 11:13:48 GMT
CAY-1979 | fix prefetches on Many-to-Many Relationships with Longvarchar

clarifying commnet


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

Branch: refs/heads/master
Commit: f8d9a780cb4e777d70154a94142059bb8ef0feb0
Parents: 49f4083
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Wed Dec 17 18:38:59 2014 +0300
Committer: Andrus Adamchik <aadamchik@apache.org>
Committed: Thu Dec 18 14:13:10 2014 +0300

----------------------------------------------------------------------
 .../access/translator/select/SelectTranslator.java   | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/f8d9a780/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/SelectTranslator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/SelectTranslator.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/SelectTranslator.java
index a2d16f1..b09fee4 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/SelectTranslator.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/SelectTranslator.java
@@ -415,11 +415,16 @@ public class SelectTranslator extends QueryAssembler {
                 for (PathComponent<DbAttribute, DbRelationship> component : table
                         .resolvePath(pathExp, getPathAliases())) {
 
-                    if (component.getRelationship() != null) {
-                        // In this case we must have forcingDistinct = false (as default)
-                        // so we don't invoke dbRelationshipAdded() and invoke pushJoin()
at once.
-                        getJoinStack().pushJoin(component.getRelationship(), component.getJoinType(),
null);
-                    }
+					if (component.getRelationship() != 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