This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch pr/434
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 32ba2af3ffb5846782ced628a79095d246d079c2
Author: Nikita Timofeev <stari...@gmail.com>
AuthorDate: Thu Sep 17 16:42:34 2020 +0300

    CAY-2641 Lazy attributes
      - revert changes in DataRowUtils logic
---
 .../java/org/apache/cayenne/access/DataRowUtils.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java 
b/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java
index 768ed80..f92d2dd 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DataRowUtils.java
@@ -89,16 +89,18 @@ class DataRowUtils {
                 ObjAttribute attr = property.getAttribute();
                 String dbAttrPath = attr.getDbAttributePath();
 
+                Object value = snapshot.get(dbAttrPath);
+                property.writePropertyDirectly(object, null, value);
+
                 // note that a check "snaphsot.get(..) == null" would be 
incorrect in this
                 // case, as NULL value is entirely valid; still save a map 
lookup by
                 // checking for the null value first
-                if (snapshot.containsKey(dbAttrPath) && !attr.isLazy()) {
-                    Object value = snapshot.get(dbAttrPath);
-                    property.writePropertyDirectly(object, null, value);
-                } else if (attr.isLazy()) {
-                    property.writePropertyDirectly(object, null, new 
AttributeFault(property));
-                } else {
-                    isPartialSnapshot[0] = true;
+                if (value == null && !snapshot.containsKey(dbAttrPath)) {
+                    if(attr.isLazy()) {
+                        property.writePropertyDirectly(object, null, new 
AttributeFault(property));
+                    } else {
+                        isPartialSnapshot[0] = true;
+                    }
                 }
 
                 return true;

Reply via email to