cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r423572 - in /incubator/cayenne/main/trunk/cayenne/cayenne-java/src: cayenne/java/org/apache/cayenne/query/RelationshipQuery.java tests/java/org/apache/cayenne/access/NestedDataContextReadTst.java
Date Wed, 19 Jul 2006 19:13:22 GMT
Author: aadamchik
Date: Wed Jul 19 12:13:22 2006
New Revision: 423572

URL: http://svn.apache.org/viewvc?rev=423572&view=rev
Log:
CAY-601 (HEAD)

Modified:
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/query/RelationshipQuery.java
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/access/NestedDataContextReadTst.java

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/query/RelationshipQuery.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/query/RelationshipQuery.java?rev=423572&r1=423571&r2=423572&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/query/RelationshipQuery.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/apache/cayenne/query/RelationshipQuery.java
Wed Jul 19 12:13:22 2006
@@ -76,11 +76,6 @@
             throw new CayenneRuntimeException("Null objectID");
         }
 
-        if (objectID.isTemporary()) {
-            throw new CayenneRuntimeException(
-                    "Temporary id can't be used in RelationshipQuery: " + objectID);
-        }
-
         this.objectId = objectID;
         this.relationshipName = relationshipName;
         this.refreshing = refreshing;

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/access/NestedDataContextReadTst.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/access/NestedDataContextReadTst.java?rev=423572&r1=423571&r2=423572&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/access/NestedDataContextReadTst.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/tests/java/org/apache/cayenne/access/NestedDataContextReadTst.java
Wed Jul 19 12:13:22 2006
@@ -197,6 +197,30 @@
         }
     }
 
+    public void testLocalObjectRelationship() throws Exception {
+        deleteTestData();
+
+        DataContext context = createDataContext();
+        DataContext childContext = context.createChildDataContext();
+
+        Artist _new = (Artist) context.createAndRegisterNewObject(Artist.class);
+        Painting _newP = (Painting) context.createAndRegisterNewObject(Painting.class);
+        _new.addToPaintingArray(_newP);
+
+        blockQueries();
+
+        try {
+
+            Painting painting = (Painting) childContext.localObject(_newP.getObjectId(),
_newP);
+            assertEquals(PersistenceState.COMMITTED, painting.getPersistenceState());
+            assertNotNull(painting.getToArtist());
+            assertEquals(PersistenceState.COMMITTED, painting.getToArtist().getPersistenceState());
+        }
+        finally {
+            unblockQueries();
+        }
+    }
+
     public void testSelect() throws Exception {
         deleteTestData();
         createTestData("testArtists");



Mime
View raw message