cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1530844 - /cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/ObjectDetachOperation.java
Date Thu, 10 Oct 2013 02:46:39 GMT
Author: aadamchik
Date: Thu Oct 10 02:46:39 2013
New Revision: 1530844

URL: http://svn.apache.org/r1530844
Log:
CAY-1798 ROP: Reverse relationships of prefetched entity objects are not filled during server
to client objects conversion.

marginally faster metadata lookup (actually not sure this is that much faster :))

Modified:
    cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/ObjectDetachOperation.java

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/ObjectDetachOperation.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/ObjectDetachOperation.java?rev=1530844&r1=1530843&r2=1530844&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/ObjectDetachOperation.java
(original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/util/ObjectDetachOperation.java
Thu Oct 10 02:46:39 2013
@@ -99,19 +99,16 @@ public class ObjectDetachOperation {
 
         descriptor.visitProperties(new PropertyVisitor() {
 
-        	private void fillReverseRelationship(Object destinationTarget, ArcProperty property)
{
-				ArcProperty reverseProperty = property.getComplimentaryReverseArc();
+            private void fillReverseRelationship(Object destinationTarget, ArcProperty property)
{
+                ArcProperty clientProperty = (ArcProperty) targetDescriptor.getProperty(property.getName());
+                if (clientProperty != null) {
+                    ArcProperty clientReverse = clientProperty.getComplimentaryReverseArc();
 
-				if (reverseProperty != null && reverseProperty instanceof ToOneProperty) {
-
-					ClassDescriptor desc = targetResolver.getClassDescriptor(
-							reverseProperty.getRelationship().getSourceEntity().getName());
-
-					ToOneProperty targetReverseProperty =
-							(ToOneProperty) desc.getProperty(reverseProperty.getName());
-					targetReverseProperty.writeProperty(destinationTarget, null, target);
-				}
-        	}
+                    if (clientReverse instanceof ToOneProperty) {
+                        clientReverse.writeProperty(destinationTarget, null, target);
+                    }
+                }
+            }
 
             public boolean visitToOne(ToOneProperty property) {
                 if (prefetchTree != null) {



Mime
View raw message