You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2007/10/25 11:17:53 UTC
svn commit: r588176 - in /cayenne/main/tags/3.0M2/cayenne:
docs/doc/src/main/resources/
framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/
framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/jira/
Author: aadamchik
Date: Thu Oct 25 02:17:52 2007
New Revision: 588176
URL: http://svn.apache.org/viewvc?rev=588176&view=rev
Log:
CAY-901 Cannot set more than one to-one relationship to null
Added:
cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_901Test.java
Modified:
cayenne/main/tags/3.0M2/cayenne/docs/doc/src/main/resources/RELEASE-NOTES.txt
cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java
Modified: cayenne/main/tags/3.0M2/cayenne/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/tags/3.0M2/cayenne/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=588176&r1=588175&r2=588176&view=diff
==============================================================================
--- cayenne/main/tags/3.0M2/cayenne/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/tags/3.0M2/cayenne/docs/doc/src/main/resources/RELEASE-NOTES.txt Thu Oct 25 02:17:52 2007
@@ -58,6 +58,7 @@
CAY-870 Race condition in ClassDescriptorMap
CAY-872 Potential bug deleting uncommited objects from a nested DataContext
CAY-873 maven-cayenne-plugin requires transitive deps declared
+CAY-901 Cannot set more than one to-one relationship to null.
----------------------------------
Release: 3.0M1
Modified: cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java?rev=588176&r1=588175&r2=588176&view=diff
==============================================================================
--- cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java (original)
+++ cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainDBDiffBuilder.java Thu Oct 25 02:17:52 2007
@@ -185,10 +185,13 @@
currentArcDiff = new HashMap();
currentArcDiff.put(arcId, null);
}
- // check for situation when a substitute arc was created prior to deleting the
- // old arc...
- else if (targetNodeId.equals(currentArcDiff.get(arcId))) {
- currentArcDiff.put(arcId, null);
+ else {
+ // skip deletion record if a substitute arc was created prior to deleting
+ // the old arc...
+ Object existingTargetId = currentArcDiff.get(arcId);
+ if (existingTargetId == null || targetNodeId.equals(existingTargetId)) {
+ currentArcDiff.put(arcId, null);
+ }
}
}
}
Added: cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_901Test.java
URL: http://svn.apache.org/viewvc/cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_901Test.java?rev=588176&view=auto
==============================================================================
--- cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_901Test.java (added)
+++ cayenne/main/tags/3.0M2/cayenne/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_901Test.java Thu Oct 25 02:17:52 2007
@@ -0,0 +1,65 @@
+/*****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ****************************************************************/
+package org.apache.cayenne.unit.jira;
+
+import java.util.Map;
+
+import org.apache.art.Artist;
+import org.apache.art.Gallery;
+import org.apache.art.Painting;
+import org.apache.cayenne.DataObjectUtils;
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.unit.CayenneCase;
+
+public class CAY_901Test extends CayenneCase {
+
+ public void testMultipleToOneDeletion() throws Exception {
+ deleteTestData();
+
+ ObjectContext context = createDataContext();
+
+ Painting p = (Painting) context.newObject(Painting.class);
+ p.setPaintingTitle("P1");
+
+ Artist a = (Artist) context.newObject(Artist.class);
+ a.setArtistName("A1");
+
+ Gallery g = (Gallery) context.newObject(Gallery.class);
+ g.setGalleryName("G1");
+
+ p.setToArtist(a);
+ p.setToGallery(g);
+ context.commitChanges();
+
+ p.setToArtist(null);
+ p.setToGallery(null);
+
+ context.commitChanges();
+
+ SQLTemplate q = new SQLTemplate(Painting.class, "SELECT * from PAINTING");
+ q.setColumnNamesCapitalization(SQLTemplate.UPPERCASE_COLUMN_NAMES);
+ q.setFetchingDataRows(true);
+
+ Map row = (Map) DataObjectUtils.objectForQuery(context, q);
+ assertEquals("P1", row.get("PAINTING_TITLE"));
+ assertEquals(null, row.get("ARTIST_ID"));
+ assertEquals(null, row.get("GALLERY_ID"));
+ }
+}