cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-1875) PrefetchSelectQuery incorrectly applies entity qualifiers
Date Thu, 26 Sep 2013 20:24:02 GMT

    [ https://issues.apache.org/jira/browse/CAY-1875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13779181#comment-13779181
] 

Mike Kienenberger commented on CAY-1875:
----------------------------------------

My limited testing so far shows that this is a working fix.

Index: framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryPrefetchRouterAction.java
===================================================================
--- framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryPrefetchRouterAction.java
(revision 1524993)
+++ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/SelectQueryPrefetchRouterAction.java
(working copy)
@@ -101,7 +101,7 @@
                 relationship);
         prefetchQuery.setStatementFetchSize(query.getStatementFetchSize());
 
-        prefetchQuery.setQualifier(classDescriptor.getEntity().translateToRelatedEntity(
+        prefetchQuery.setQualifier(relationship.getTargetEntity().translateToRelatedEntity(
                 queryQualifier,
                 prefetchPath));
 
However, a large amount of tests fail once this is in place:

Tests in error: 
  testReadToManyPrefetching(org.apache.cayenne.CDOSetRelationshipTest)
  testPrefetchEmployee(org.apache.cayenne.query.SelectQueryPrefetchRouterActionQualifiedEntityTest)
  testPrefetchManager(org.apache.cayenne.query.SelectQueryPrefetchRouterActionQualifiedEntityTest)
  testPaintings1(org.apache.cayenne.query.SelectQueryPrefetchRouterActionTest)
  testPrefetchPaintings2(org.apache.cayenne.query.SelectQueryPrefetchRouterActionTest)
  testGalleries(org.apache.cayenne.query.SelectQueryPrefetchRouterActionTest)
  testToManyToManyFirstStepUnresolved(org.apache.cayenne.access.DataContextPrefetchMultistepTest)
  testToManyToManyFirstStepResolved(org.apache.cayenne.access.DataContextPrefetchMultistepTest)
  testMixedPrefetch1(org.apache.cayenne.access.DataContextPrefetchMultistepTest)
  testMixedPrefetch2(org.apache.cayenne.access.DataContextPrefetchMultistepTest)
  testPrefetch1(org.apache.cayenne.access.SimpleIdIncrementalFaultListPrefetchTest)
  testPrefetch3(org.apache.cayenne.access.SimpleIdIncrementalFaultListPrefetchTest)
  testPrefetch4(org.apache.cayenne.access.SimpleIdIncrementalFaultListPrefetchTest)
  testSelectQueryPrefetchToOne(org.apache.cayenne.access.ClientServerChannelQueryTest)
  testSelectQueryPrefetchToMany(org.apache.cayenne.access.ClientServerChannelQueryTest)
  testMatchingOnSuperAttributesWithPrefetch(org.apache.cayenne.access.SingleTableInheritanceTest)
  testPrefetchToMany_WithQualfier(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch_ToManyNoReverseWithQualifier(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch_ToOne_DbPath(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch_ToOne_ObjPath(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch_ToOneWithQualifierOverlappingPrefetchPath(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch9(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch_OneToOneWithQualifier(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetchToMany_DateInQualifier(org.apache.cayenne.access.DataContextPrefetchTest)
  testPrefetch10(org.apache.cayenne.access.DataContextPrefetchExtrasTest)
  testPrefetch11(org.apache.cayenne.access.DataContextPrefetchExtrasTest)
  testReadToManyPrefetching(org.apache.cayenne.CDOMapRelationshipTest)
  testToManyDisjointOverlappingQualifierWithInnerJoin(org.apache.cayenne.access.DataContextPrefetchQualifierOverlapTest)
  testRouteWithPrefetches(org.apache.cayenne.query.SelectQueryTest)
  testRouteQueryWithPrefetchesNoReverse(org.apache.cayenne.query.SelectQueryTest)
  testRouteQueryWithPrefetchesPrefetchExpressionPath(org.apache.cayenne.query.SelectQueryTest)
  testLeftJoinAndPrefetchToMany(org.apache.cayenne.query.SelectQueryTest)
  testLeftJoinAndPrefetchToOne(org.apache.cayenne.query.SelectQueryTest)
  testReadToManyPrefetching(org.apache.cayenne.CDOCollectionRelationshipTest)
  testEqual(org.apache.cayenne.exp.ParsedExpQualifierCompatTest)


                
> PrefetchSelectQuery incorrectly applies entity qualifiers
> ---------------------------------------------------------
>
>                 Key: CAY-1875
>                 URL: https://issues.apache.org/jira/browse/CAY-1875
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.1B2
>            Reporter: Mike Kienenberger
>
> The modeler's entity qualifier isn't applied to prefetch queries.
> http://www.mail-archive.com/user@cayenne.apache.org/msg08241.html
> Andrus:
> > This is bad and is not supposed to happen. Appears to be a bug. I am checking
> > SelectQueryPrefetchRouterAction, and it applies *root* entity qualifier to prefetch
query instead of
> > prefetched entity. Should be a relatively easy fix for "disjoint" prefetches at
least.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message