cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1501798 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java
Date Wed, 10 Jul 2013 15:38:58 GMT
Author: aadamchik
Date: Wed Jul 10 15:38:58 2013
New Revision: 1501798

URL: http://svn.apache.org/r1501798
Log:
CAY-1695  Unexpected null value in bidirectional one-to-one prefetch

test case - patch by      Andrei Veprev
(andrus - generics refactoring, tweaking asserts)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java?rev=1501798&r1=1501797&r2=1501798&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextPrefetchTest.java
Wed Jul 10 15:38:58 2013
@@ -686,4 +686,26 @@ public class DataContextPrefetchTest ext
             }
         });
     }
+
+    public void testPrefetchToOneWithBackRelationship() throws Exception {
+        createArtistWithTwoPaintingsAndTwoInfosDataSet();
+
+        SelectQuery<Painting> query = new SelectQuery<Painting>(Painting.class);
+        query.andQualifier(Painting.PAINTING_TITLE.eq("p_artist2"));
+        query.addPrefetch(Painting.TO_PAINTING_INFO.disjoint());
+        query.addPrefetch(Painting.TO_PAINTING_INFO.dot(PaintingInfo.PAINTING).disjoint());
+        final List<Painting> results = context.select(query);
+
+        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
+
+            public void execute() {
+                assertEquals(1, results.size());
+
+                Painting p0 = results.get(0);
+                PaintingInfo pi0 = (PaintingInfo) p0.readProperty(Painting.TO_PAINTING_INFO.getName());
+                assertNotNull(pi0);
+                assertNotNull(pi0.readProperty(PaintingInfo.PAINTING.getName()));
+            }
+        });
+    }
 }



Mime
View raw message