You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by jo...@apache.org on 2016/08/09 16:30:31 UTC

[2/6] cayenne git commit: Fix flattened attributes

Fix flattened attributes


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/b93a51c6
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/b93a51c6
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/b93a51c6

Branch: refs/heads/ics11
Commit: b93a51c61ee491b9d9e188dadc0d6606f264a28b
Parents: 34bdd84
Author: John Huss <jo...@apache.org>
Authored: Fri Jan 31 17:00:47 2014 -0600
Committer: John Huss <jo...@apache.org>
Committed: Wed Jun 24 11:40:12 2015 -0500

----------------------------------------------------------------------
 .../cayenne/access/DataNodeSyncQualifierDescriptor.java      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/b93a51c6/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java b/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
index 4d037ac..9f117da 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
@@ -109,7 +109,7 @@ class DataNodeSyncQualifierDescriptor {
 
                             public Object transform(Object input) {
                                 ObjectId id = (ObjectId) ((ObjectDiff) input).getNodeId();
-                                return id.getIdSnapshot().get(dbAttrPair.getSourceName());
+                                return id.getIdSnapshot().get(dbAttrPair.getTargetName());
                             }
                         });
                     }
@@ -117,16 +117,16 @@ class DataNodeSyncQualifierDescriptor {
             }
         }
 
-        if (usingOptimisticLocking) {
+        if (descriptor.isMaster() && usingOptimisticLocking) {
 
             for (final ObjAttribute attribute : descriptor.getEntity().getAttributes()) {
 
-                if (attribute.isUsedForLocking()) {
+                if (attribute.isUsedForLocking() && !attribute.isFlattened()) {
                     // only care about first step in a flattened attribute
                     DbAttribute dbAttribute = (DbAttribute) attribute
                             .getDbPathIterator()
                             .next();
-
+                    
                     if (!attributes.contains(dbAttribute)) {
                         attributes.add(dbAttribute);